In JavaScript, for a given property containing a Number value, is it possible to retrieve the actual binary value – the 64 bits representing the value.
var x = 13;
What 64 bits are stored in the memory location that x points to?
I know that there are IEEE 754 converters out there. But is it possible to retrieve the actual live binary value from the memory cell? BTW, I don’t need this for any application, I’m just curious…
See Converting a decimal value to a 32bit floating-point hexadecimal, where you can find the code for the 32-bit case. Converting that for the 64-bit case should be really straight-forward.
Well, except for the fact that JavaScript doesn’t guarantee you anything about the actual data type that represents a
Number, so you might get overflows if your JavaScript implementation only uses 32 bits for representingNumbers.