If I run the factorial(1:200)
, the largest value is 7.257416e+306
, any value above that is "Inf"
.
7.257416e+306
. We can not calculate the value above factorial(170)
? 1.797693e+308
. So, I am a bit confused, which one is the biggest value in R?
The largest number in base R has nothing to do with the factorial function. The likelihood that the largest number is going to coincide with a factorial is very small. The largest representable number differs depending on your computer. You can see it by running. .Machine$double.xmax
. Everything above that is Inf
.
You see 171*factorial(170)
is simply larger than your machine's .Machine$double.xmax
even though factorial(170)
is smaller.
If you want larger numbers in R consider the discussion in this question
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.