Package org.webpki.util
Class Float64Stringifier
java.lang.Object
org.webpki.util.Float64Stringifier
IEEE-754 double to string encoder.
An implementation of Ryu for serializing IEEE-754 double precision values as specified by ECMAScript as well as by CBOR diagnostic notation.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Float64Stringifier
public Float64Stringifier()
-
-
Method Details
-
encode
Formats a number according to ECMAScript.This code is emulating 7.1.12.1 of the EcmaScript V6 specification.
Note: {-
}0.0
,NaN
, and±Infinity
is out of scope for this method.- Parameters:
value
- Value to be formattedecmaOriginalMode
- Iftrue
use EcmaScript notation. Iffalse
use EcmaScript notation but always output a decimal point and at least one fractional digit. The latter is compatible with CBOR diagnostic notation- Returns:
- String representation
-