Questions tagged [nan-boxing]

NaN stands for Not-a-Number. NaN-boxing is a technique that use for dynamically storing data.It optimizes for fast floating-point operations, and for allowing a larger amount of meaningful values to be represented in 64 bits.

NaN-boxing technology: A 64-bit number to represent multiple data types. It saves data by a nan floating point number. It is based on the IEEE-754 floating point standard.

History

The NaN-boxing technology was originally used by Amazon engineers in the javascript engine. Luajit and Rubyjit also use it as a dynamic type to store data.

2 questions
8
votes
1 answer

Why does V8 uses pointer tagging and not NaN boxing?

I'm learning V8 internals now. I learned that V8 uses pointer tagging for value storing, but wondered why it is not use NaN boxing. AFAIK, NaN boxing is better because it can also store doubles and not just SMIs. I've read this, and understand (if…
Chayim Friedman
  • 47,971
  • 5
  • 48
  • 77
0
votes
0 answers

Storing address of mpz_t and passing the pointer around

From what I understand, mpz_t are nothing but a single-item array. According to gmp.h: { short int _mp_alloc; /* Number of *limbs* allocated and pointed to by the D field. */ short int _mp_size; /* abs(SIZE) is the…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223