return 0.0; if (m == Long.MIN_VALUE) return toDoublePow2(Long.MIN_VALUE >> 1, n + 1); if (m < 0) return -toDoublePow2(-m, n); int bitLength = MathLib.bitLength(m); int shift = bitLength - 53; if (exp <= -54) return 0.0; return toDoublePow2(m, n + 54) / 18014398509481984L; // 2^54 Exact.
return 0.0; if (m == Long.MIN_VALUE) return toDoublePow2(Long.MIN_VALUE >> 1, n + 1); if (m < 0) return -toDoublePow2(-m, n); int bitLength = MathLib.bitLength(m); int shift = bitLength - 53; if (exp <= -54) return 0.0; return toDoublePow2(m, n + 54) / 18014398509481984L; // 2^54 Exact.
return 0.0; if (m == Long.MIN_VALUE) return toDoublePow2(Long.MIN_VALUE >> 1, n + 1); if (m < 0) return -toDoublePow2(-m, n); int bitLength = MathLib.bitLength(m); int shift = bitLength - 53; if (exp <= -54) return 0.0; return toDoublePow2(m, n + 54) / 18014398509481984L; // 2^54 Exact.
return 0.0; if (m == Long.MIN_VALUE) return toDoublePow2(Long.MIN_VALUE >> 1, n + 1); if (m < 0) return -toDoublePow2(-m, n); int bitLength = MathLib.bitLength(m); int shift = bitLength - 53; if (exp <= -54) return 0.0; return toDoublePow2(m, n + 54) / 18014398509481984L; // 2^54 Exact.
/** * Returns the value of this large integer as a <code>double</code>. * * @return the numeric value represented by this integer after conversion * to type <code>double</code>. */ public double doubleValue() { if (_size == 0) return 0; if (_size <= 1) return _isNegative ? -_words[0] : _words[0]; // Calculates bits length (ignores sign). final int n = _size - 1; final int bitLength = MathLib.bitLength(_words[n]) + (n << 6) - n; // Keep 63 most significant bits. int shift = 63 - bitLength; LargeInteger int63 = this.times2pow(shift); double d = MathLib.toDoublePow2(int63._words[0], -shift); return _isNegative ? -d : d; }
long mantissa = (shift < 0) ? (x3 << 31) | (x2 >>> 1) : // x3 is 32 bits. (((x3 << 32) | x2) << shift) | (x1 >>> (32 - shift)); return toDoublePow2(mantissa, pow2); pow2 -= i; return toDoublePow2(x1, pow2);
long mantissa = (shift < 0) ? (x3 << 31) | (x2 >>> 1) : // x3 is 32 bits. (((x3 << 32) | x2) << shift) | (x1 >>> (32 - shift)); return toDoublePow2(mantissa, pow2); pow2 -= i; return toDoublePow2(x1, pow2);
long mantissa = (shift < 0) ? (x3 << 31) | (x2 >>> 1) : // x3 is 32 bits. (((x3 << 32) | x2) << shift) | (x1 >>> (32 - shift)); return toDoublePow2(mantissa, pow2); pow2 -= i; return toDoublePow2(x1, pow2);
long mantissa = (shift < 0) ? (x3 << 31) | (x2 >>> 1) : // x3 is 32 bits. (((x3 << 32) | x2) << shift) | (x1 >>> (32 - shift)); return toDoublePow2(mantissa, pow2); pow2 -= i; return toDoublePow2(x1, pow2);