Have trouble while compiling large integer multiplications. Here’s an example
This yields the desired result in vanilla JS with the number
type.
Have trouble while compiling large integer multiplications. Here’s an example
This yields the desired result in vanilla JS with the number
type.
Integers are 32 bit and are not mapped to number
types in JS. Use float
values instead, if you are doing any crucial calculation stuff.
let correct = 500. *. 1024. *. 1024.
let incorrect1 = 5000. *. 1024. *. 1024.
let incorrect2 = 20000. *. 1024. *. 1024.
Related: Numbers overflow problem