64 bit integer support

Alessandro Pignotti edited this page Dec 14, 2015 · 6 revisions

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:

  1. Using 32-bit integers if their range is enough for your purposes
  2. 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)
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.