Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Factorial algorithm in fortran language
Factorial algorithm in fortran language
Because by default, the integer type is a four-byte integer, and the maximum value is 2 31-1= 2147483647. The factorial of 13 is 6227020800, which has exceeded the upper limit of integer.

Real*8 double precision type can be used instead, so that n=33 will not overflow. The upper limit of double precision type is 10 to the 308th power, and the maximum can be calculated to the factorial of n= 170, that is, 170.