Carpet

Carpet

2M Downloads

`scarpet`: Function `fact(x)` truncates to a signed `long` instead of converting to `double`

James103 opened this issue ยท 0 comments

commented

As of Carpet mod 1.4.45 and Minecraft 1.17.1, when you run /script run fact(21) (or any bigger value of x for fact), the result is truncated to a 64-bit integer instead of rounding off to a 64-bit floating point value.

fact(20) = 2432902008176640000
fact(21) = -4249290049419214848
fact(20) * 21.0 = -4249290049419214848
fact(20) * 1.05 * 20 = 51090942171700000000
fact(20)^1 * 21 = 51090942171700000000