math - How can I calculate the factorial of a double in c++ -


i hoping there library function somewhere can this. , yes important factorial of double value (that needs work non-integer values).

the c99 standard library contains gamma function, double tgamma(double). closely related factorial, can define:

#include <cmath>  double factorial(double x) {return std::tgamma(x+1);} 

this should available in c++11 implementation, not guaranteed in c++03 implementation, might include c90 library. if implementation doesn't have it, boost.math library does.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -