std::tgamma
cppreference.com
[] |
Google. . , . , . |
<metanoindex/>
<tbody> </tbody> float tgamma( float arg ); |
( C++11) | |
double tgamma( double arg ); |
( C++11) | |
long double tgamma( long double arg ); |
( C++11) | |
double tgamma( Integral arg ); |
( C++11) | |
| arg |
-
0targ-1
e-t dt.
arg, ∫0targ-1
e-t dt.
arg , std::tgamma(arg) arg-1.arg , FE_UNDERFLOW . , .
:
Many implementations calculate the exact integer-domain factorial if the argument is a sufficiently small integer.
#include <iostream>
#include <cmath>
double factorial(double arg)
{
return std::tgamma(arg + 1);
}
int main()
{
std::cout << "The factorial of 5 is " << factorial(5) << '\n'
<< "The factorial of 100 is " << factorial(100) << '\n';
}
:
The factorial of 5 is 120
The factorial of 100 is 9.33262e+157
.
(C++11)(C++11)(C++11) |
- () |
Weisstein, Eric W. "Gamma Function." MathWorld - Wolfram Web.