Int64.js
function(allowImprecise) {
    var b = this.buffer, o = this.offset;

    // Running sum of octets, doing a 2's complement
    var negate = b[o] & 0x80, x = 0, carry = 1;
    for (var i = 7, m = 1; i >= 0; i--, m *= 256) {
      var v = b[o+i];

      // 2's complement for negative numbers
      if (negate) {
        v = (v ^ 0xff) + carry;
        carry = v >> 8;
        v = v & 0xff;
      }

      x += v * m;
    }

    // Return Infinity if we've lost integer precision
    if (!allowImprecise && x >= Int64.MAX_INT) {
      return negate ? -Infinity : Infinity;
    }

    return negate ? -x : x;
  }
function(allowImprecise) {
    var b = this.buffer, o = this.offset;

    // Running sum of octets, doing a 2's complement
    var negate = b[o] & 0x80, x = 0, carry = 1;
    for (var i = 7, m = 1; i >= 0; i--, m *= 256) {
      var v = b[o+i];

      // 2's complement for negative numbers
      if (negate) {
        v = (v ^ 0xff) + carry;
        carry = v >> 8;
        v = v & 0xff;
      }

      x += v * m;
    }

    // Return Infinity if we've lost integer precision
    if (!allowImprecise && x >= Int64.MAX_INT) {
      return negate ? -Infinity : Infinity;
    }

    return negate ? -x : x;
  }
function ( allowImprecise ) { var b = this . buffer , o = this . offset ; // Running sum of octets, doing a 2's complement var negate = b [ o ] & 0x80 , x = 0 , carry = 1 ; for ( var i = 7 , m = 1 ; i >= 0 ; i -- , m *= 256 ) { var v = b [ o + i ] ; // 2's complement for negative numbers if ( negate ) { v = ( v ^ 0xff ) + carry ; carry = v >> 8 ; v = v & 0xff ; } x += v * m ; } // Return Infinity if we've lost integer precision if ( ! allowImprecise && x >= Int64 . MAX_INT ) { return negate ? - Infinity : Infinity ; } return negate ? - x : x ; }
Convert to a native JS number.

WARNING: Do not expect this value to be accurate to integer precision for
large (positive or negative) numbers!

@param allowImprecise If true, no check is performed to verify the
returned value is accurate to integer precision.  If false, imprecise
numbers (very large positive or negative numbers) will be forced to +/-
Infinity.
Convert to a native JS number .