![]() |
TTMath
0.9.4
C++ bignum library
|
#include <ttmathobjects.h>
Public Member Functions | |
void | InitAll () |
Data Fields | |
std::vector< ValueType > | fact |
std::vector< ValueType > | bern |
History< ValueType > | history |
this is an auxiliary class used when calculating Gamma() or Factorial()
in multithreaded environment you can provide an object of this class to the Gamma() or Factorial() function, e.g;
typedef Big<1, 3> MyBig; MyBig x = 123456; CGamma<MyBig> cgamma; std::cout << Gamma(x, cgamma);
each thread should have its own CGamma<> object
in a single-thread environment a CGamma<> object is a static variable and you don't have to explicitly use it, e.g.
typedef Big<1, 3> MyBig; MyBig x = 123456; std::cout << Gamma(x);
Definition at line 742 of file ttmathobjects.h.
void ttmath::CGamma< ValueType >::InitAll | ( | ) |
this method prepares some coefficients: factorials and Bernoulli numbers stored in 'fact' and 'bern' objects
how many values should be depends on the size of the mantissa - if the mantissa is larger then we must calculate more values for a mantissa which consists of 256 bits (8 words on a 32bit platform) we have to calculate about 30 values (the size of fact and bern will be 30), and for a 2048 bits mantissa we have to calculate 306 coefficients
you don't have to call this method, these coefficients will be automatically calculated when they are needed
you must note that calculating these coefficients is a little time-consuming operation, (especially when the mantissa is large) and first call to Gamma() or Factorial() can take more time than next calls, and in the end this is the point when InitAll() comes in handy: you can call this method somewhere at the beginning of your program
this method prepares some coefficients: factorials and Bernoulli numbers stored in 'fact' and 'bern' objects
we're defining the method here because we're using Gamma() function which is not available in ttmathobjects.h
read the doc info in ttmathobjects.h file where CGamma<> struct is declared
Definition at line 2840 of file ttmath.h.
References ttmath::Gamma(), and TTMATH_GAMMA_BOUNDARY.
Referenced by ttmath::Parser< ValueType >::InitCGamma().
std::vector<ValueType> ttmath::CGamma< ValueType >::bern |
this table holds Bernoulli numbers 1 -0.5 0.166666666666666666666666667 0 -0.0333333333333333333333333333 0 0.0238095238095238095238095238 0 -0.0333333333333333333333333333 0 0.075757575757575757575757576 .....
Definition at line 773 of file ttmathobjects.h.
std::vector<ValueType> ttmath::CGamma< ValueType >::fact |
this table holds factorials 1 1 2 6 24 120 720 .......
Definition at line 755 of file ttmathobjects.h.
History<ValueType> ttmath::CGamma< ValueType >::history |
here we store some calculated values (this is for speeding up, if the next argument of Gamma() or Factorial() is in the 'history' then the result we are not calculating but simply return from the 'history' object)
Definition at line 782 of file ttmathobjects.h.
Referenced by ttmath::Gamma().