Interface DoubleParser


  • public interface DoubleParser
    A fast double parser inspired from https://github.com/wrandelshofer/FastDoubleParser
    • Field Detail

      • MINIMAL_NINETEEN_DIGIT_INTEGER

        static final long MINIMAL_NINETEEN_DIGIT_INTEGER
        See Also:
        Constant Field Values
      • DOUBLE_MIN_EXPONENT_POWER_OF_TEN

        static final int DOUBLE_MIN_EXPONENT_POWER_OF_TEN
        See Also:
        Constant Field Values
      • DOUBLE_MAX_EXPONENT_POWER_OF_TEN

        static final int DOUBLE_MAX_EXPONENT_POWER_OF_TEN
        See Also:
        Constant Field Values
      • DOUBLE_POWERS_OF_TEN

        static final double[] DOUBLE_POWERS_OF_TEN
      • DOUBLE_MAX_EXPONENT_POWER_OF_TWO

        static final int DOUBLE_MAX_EXPONENT_POWER_OF_TWO
        See Also:
        Constant Field Values
      • MANTISSA_64

        static final long[] MANTISSA_64
        When mapping numbers from decimal to binary, we go from w * 10^q to m * 2^p, but we have 10^q = 5^q * 2^q, so effectively we are trying to match w * 2^q * 5^q to m * 2^p.

        Thus, the powers of two are not a concern since they can be represented exactly using the binary notation, only the powers of five affect the binary significand.

        The mantissas of powers of ten from -308 to 308, extended out to sixty-four bits. The array contains the powers of ten approximated as a 64-bit mantissa. It goes from 10^-325 to 10^308 (inclusively). The mantissa is truncated, and never rounded up. Uses about 5 KB.

         long getMantissaHigh(int q) {
          MANTISSA_64[q - SMALLEST_POWER_OF_TEN];
         }
         
    • Method Detail

      • parseFloatingPointLiteral

        static double parseFloatingPointLiteral​(String str,
                                                int offset,
                                                int endIndex)
      • unsignedMultiplyHigh

        static long unsignedMultiplyHigh​(long x,
                                         long y)