Package dev.gmitch215.bytebox.text
Class DoubleSynthesizer
java.lang.Object
dev.gmitch215.bytebox.text.DoubleSynthesizer
Where
DecimalFormat gets the double for a number it read, in place of the class library's.
The original multiplies by a 64-bit table entry and rounds, so its answer is off by one unit in
the last place for some decimals (1e23, 3.687639494787356E-165) and is zero for
4.9E-324. The platform's Number rounds a decimal correctly, so the digits the lexer
collected are handed to it. The lexer keeps the first 19 significant digits and drops the rest.
Found through Substitutions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublesynthesizeDouble(long mantissa, int exp, boolean negative)
-
Method Details
-
synthesizeDouble
public static double synthesizeDouble(long mantissa, int exp, boolean negative) - Parameters:
mantissa- up to 19 digits, unsigned, the first at 10^18exp- the power of ten of the first digitnegative- whether the sign was a minus- Returns:
- the double nearest the decimal
-