public DecodedDouble(double value) {
      final long longBits = Double.doubleToLongBits(value);
      sign = decodeDoubleSign(longBits);
      final int rawExponent = decodeDoubleExponent(longBits);
      final long rawMantissa = decodeDoubleMantissa(longBits);
      if (rawExponent > 0 && rawExponent < 2047) {
        exponent = rawExponent - 1023 - 52;
        mantissa = rawMantissa | 0x10000000000000L;
      } else if (rawExponent == 0) {
        if (rawMantissa != 0) {
          // denormalized number
          exponent = rawExponent - 1022 - 52;
          mantissa = rawMantissa;
        } else {
          exponent = 0;
          mantissa = 0;
        }
      } else {
        throw new NumberFormatException();
      }
    }