Interface DoubleParser


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

    • MAX_EXPONENT_NUMBER

      static final int MAX_EXPONENT_NUMBER
      See Also:
    • ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH

      static final String ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH
      See Also:
    • SYNTAX_ERROR

      static final String SYNTAX_ERROR
      See Also:
    • MINIMAL_NINETEEN_DIGIT_INTEGER

      static final long MINIMAL_NINETEEN_DIGIT_INTEGER
      See Also:
    • DOUBLE_MIN_EXPONENT_POWER_OF_TEN

      static final int DOUBLE_MIN_EXPONENT_POWER_OF_TEN
      See Also:
    • DOUBLE_MAX_EXPONENT_POWER_OF_TEN

      static final int DOUBLE_MAX_EXPONENT_POWER_OF_TEN
      See Also:
    • DOUBLE_SIGNIFICAND_WIDTH

      static final int DOUBLE_SIGNIFICAND_WIDTH
      See Also:
    • 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:
    • DOUBLE_EXPONENT_BIAS

      static final int DOUBLE_EXPONENT_BIAS
      See Also:
    • 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 Details

    • parseFloatingPointLiteral

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

      static long unsignedMultiplyHigh(long x, long y)