top | item 41880864

(no title)

BillyTheKing | 1 year ago

this is the thing with JS and TS - the types and stuff, it's all good until you realise that all integers are basically int 52 (represented as float 64, with 52 bits for the fraction).

Yes, it's nice and flexible - but also introduces some dangerous subtle bugs.

discuss

order

8n4vidtmkvmk|1 year ago

2^53-1 I thought.

And no, they're not all that. There's a bunch that are 2^32 such as this timeout, apparently, plus all the bit shift operations.

vhcr|1 year ago

Not ALL integers are 52 bit, BigInts were added on ECMAScript 2020.