Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
64 bit integer support
Numerical types in the browser
The only numeric type that is natively supported on the browser platform is Number, which is an IEEE 64-bit floating point value (
double). doubles can be used to implement 32-bit integers since their range is fully representable inside a double.
64-bit integers support on Cheerp
Supporting 64-bit integers is only possible by combining two 32-bit integers. This is done automatically by the compiler but may cause performance issues.
If you are using 64-bit integers in performance critical paths you may consider:
- Using 32-bit integers if their range is enough for your purposes
- Using doubles if you are ok with losing precision with values larger than 2^52 (the size of the mantissa on doubles is 52 bit)