Class ToonNumbers
java.lang.Object
io.micronaut.serde.toon.util.ToonNumbers
Formats numbers in the canonical decimal form required by the TOON
specification: no leading zeros, no trailing fractional zeros,
-0
normalized to 0, NaN/infinite values encoded as
null, and scientific notation only outside the
1e-6 <= |n| < 1e21 magnitude window. A BigInteger outside
the long range is written as a quoted plain decimal string, so
that no precision is lost.- Since:
- 3.3.0
- See Also:
-
Method Summary
-
Method Details
-
format
Formats the given number in canonical TOON decimal form.- Parameters:
number- The number to format- Returns:
- The canonical decimal (or, outside the plain-form magnitude
window, scientific notation) representation, a quoted decimal string
for a
BigIntegeroutside thelongrange, or"null"for aNaNor infinite floating point value
-