Reputation: 167
When I run factorial(100)
in the console, I get
factorial(100)
# [1] 9.332622e+157
But I want to see the exact value of factorial(100)
. How would I do it?
Upvotes: 5
Views: 5880
Reputation: 42689
The gmp
library might do what you want. I have not verified that this is the correct result:
> library(gmp)
> j <- as.bigz(100)
> factorial(j)
Big Integer ('bigz') :
[1] 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
See also Multiplication of large integers in R
Upvotes: 6