All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
ttmath::CGamma< ValueType > Struct Template Reference

#include <ttmathobjects.h>

Public Member Functions

void InitAll ()
 

Public Attributes

std::vector< ValueType > fact
 
std::vector< ValueType > bern
 
History< ValueType > history
 

Detailed Description

template<class ValueType>
struct ttmath::CGamma< ValueType >

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 in a second version of Gamma() and you don't have to explicitly use it, e.g. typedef Big<1, 3> MyBig; MyBig x = 123456; std::cout << Gamma(x);

Member Function Documentation

template<class ValueType >
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

Member Data Documentation

template<class ValueType>
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 .....

template<class ValueType>
std::vector<ValueType> ttmath::CGamma< ValueType >::fact

this table holds factorials 1 1 2 6 24 120 720 .......

template<class ValueType>
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)


The documentation for this struct was generated from the following files: