Maximum value of an integer for which factorial can be calculated on a machine | Javascript program to find maximum value of an integer for which factorial can be calculated on your system ; When fact crosses its size , it gives negative value ; Driver Code
function findMaxValue ( ) { let res = 2 ; let fact = 2 ; while ( true ) { if ( fact < 0 fact > 9223372036854775807 ) break ; res ++ ; fact = fact * res ; } return res - 1 ; } document . write ( " " + " " + findMaxValue ( ) ) ;