Saturday, 8 April 2017

Is there a way to see how node js stores numbers internally?

I'm working on improving my understanding of floating points in Node. My understanding is that every number in javascript is stored as a 64-bit floating point (which is kind of insane, and pretty cool) and I want to play around with these a little bit.

Is there an easy way to print out how an arbitrary number is stored internally? Something like (5).toFloatRepresentation() which would return 101...?

I looked around online and couldn't find anything -- if I missed something obvious, I apologize!

I know I could write a function that did this, but I'm interested in looking at things from the other side!

Thanks!



via Peter Dolan

No comments:

Post a Comment