Package org.apache.sysds.utils
Interface DoubleParser
-
public interface DoubleParser
A fast double parser inspired from https://github.com/wrandelshofer/FastDoubleParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DoubleParser.UInt128
-
Field Summary
Fields Modifier and Type Field Description static int
DOUBLE_EXPONENT_BIAS
static int
DOUBLE_MAX_EXPONENT_POWER_OF_TEN
static int
DOUBLE_MAX_EXPONENT_POWER_OF_TWO
static int
DOUBLE_MIN_EXPONENT_POWER_OF_TEN
static double[]
DOUBLE_POWERS_OF_TEN
static int
DOUBLE_SIGNIFICAND_WIDTH
static String
ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH
static 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.static int
MAX_EXPONENT_NUMBER
static long
MINIMAL_NINETEEN_DIGIT_INTEGER
static String
SYNTAX_ERROR
-
Method Summary
Static Methods Modifier and Type Method Description static double
parseFloatingPointLiteral(String str, int offset, int endIndex)
static long
unsignedMultiplyHigh(long x, long y)
-
-
-
Field Detail
-
MAX_EXPONENT_NUMBER
static final int MAX_EXPONENT_NUMBER
- See Also:
- Constant Field Values
-
ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH
static final String ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH
- See Also:
- Constant Field Values
-
SYNTAX_ERROR
static final String SYNTAX_ERROR
- See Also:
- Constant Field Values
-
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_SIGNIFICAND_WIDTH
static final int DOUBLE_SIGNIFICAND_WIDTH
- 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
-
DOUBLE_EXPONENT_BIAS
static final int DOUBLE_EXPONENT_BIAS
- 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)
-
-