-
-
Notifications
You must be signed in to change notification settings - Fork 4
int
Short for integer, slightly different to natural numbers and ints of other languages: While [[number]] should be the only number type used by Angle developers, note that int in our context mostly means int32 but can also mean i64 “long” or int60 (you won't miss those extra 4 bits).
The reason is that the internal value field of node_pointer is 64 bits, so this is the basis for all calculations.
The 4 extra bits of int60 handle sign ±infinity nan/undefined and overflow. overflow is useful because an overflow number is still comparible: infinity < overflow < max-int.
In the primitive number type as well as in its lightweight wrapper class Number, numbers get automatically upgraded: if you multiply two int8 (bytes) you may get an int16, if you multiply two int60 you may get a bignum (which may or may not be different to javascripts bignum).
If you interact with ABIs where int means int32 or i64, our runtime handles the conversion, or the compiler gives a warning.