Skip to content

Instantly share code, notes, and snippets.

View solowt's full-sized avatar

Thomas Solow solowt

  • Esri
  • Washington DC
View GitHub Profile
function getNumberParts(x) {
    var float = new Float64Array(1),
        bytes = new Uint8Array(float.buffer);

    float[0] = x;

    var sign = bytes[7] >> 7,
        exponent = ((bytes[7] & 0x7f) << 4 | bytes[6] >> 4) - 0x3ff;

#Binary and Octal Literals In in ES5, hexadecimal numbers can be represented with 0x in front of the number:

console.log(0xFFFFF);

Now, in ES6, a similar feature has been added for binary and octal numbers: