so my game is rebirth simulator 2.0 and it is basically about numbers but the problem is that when i go more than 1e300 it changes to inf, how do i fix it

`2 ** 1024`

(`1e308`

approximately) or higher than that will return infinity for a `double`

value. You’ve passed the max value of a `double`

thus it returns infinity.

```
#include <stdio.h>
#include <float.h>
#include <math.h>
int main()
{
printf("%f\n%f", DBL_MAX, pow(2.0, 1024));
return 0;
}
```

returns

179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000

inf

Use BigInt/BigNum if you want to fix that (and you’re not using decimals) but there isn’t a `BigIntValue`

.

Lua 5.1 uses double as a number. This applies to NumberValue.

NumberValue uses a double precision floating point (basically in Lua’s term `number`

) value which can store up to 2 ** 1024 (1e308) (though some precision will be lost). `double`

values can go up to 2 ** 1024. `tonumber`

function converts it to double so it’ll still return infinity.

```
tonumber('1' .. ('0'):rep(308)) --> inf
```

Strings could work for converitng it to BigInt though.

this post is irrelevant to the problem and your not really giving a solution.

The title:

Number value - inf num problem

How is it irrelevant to the problem? The OP clearly stated the problem is about the `NumberValue`

(not `IntValue`

) turning to infinity. Lua number can only store up to 10e307. BigInt/BigNum serialising to strings and vice versa is (probably) the soultion, it can handle large values without turning it to infinity.

I know but he probably has no idea what int main() { … } or #include <…h> is LOL.