-2

I recently found about the topic nan boxing, I'm also trying to build a dynamic typed programming language so nan boxing seemed the choice to represent the types but I'm still a lot confused about it, one of them is how would i store data like a 64 bit integer, one way i think will work is heap allocating them, as it decreases the size since now it points to the memory rather than the whole integer, but wouldn't that be slow and inefficient? Part of this question comes from my other confusion: How can javascript represent numbers as high as Number.MAX_SAFE_INTEGER if it uses IEEE 754 doubles (wouldn't it be limited to 32 bit ints then?), sorry if i sound stupid I'm just new to this kind of bitwise things.

Yksisarvinen
  • 18,008
  • 2
  • 24
  • 52
PoLLeN
  • 61
  • 7

1 Answers1

0

I think i got it, i was really being stupid, since nans are doubles anyway and doubles are 64 bits, i could represent all numbers as doubles like javascript does and store it as a 32 bit int if possible because ints are faster when possible, i'd like further feedback if possible.

PoLLeN
  • 61
  • 7