DoubleFormatter
Turns a double into a set of digits and an exponent, the same code Jackson and OpenJDK use.
References:
Giulietti, "The Schubfach way to render doubles"
IEEE Computer Society, "IEEE Standard for Floating-Point Arithmetic"
Bouvier and Zimmermann, "Division-Free Binary-to-Decimal Conversion"
Divisions are avoided throughout, which helps architectures where they are slow. Section 10 of reference 1 covers that.
Functions
Link copied to clipboard
toString's layout with the digits java.lang.Double.toString picks, which keep two where one would do for a few tiny subnormals: 4.9e-324 rather than 5e-324 for MIN_VALUE.