Class DoubleCoreSerializer

java.lang.Object
org.webpki.util.DoubleCoreSerializer

public final class DoubleCoreSerializer extends Object
An implementation of Ryu for serializing IEEE-754 double precision values as specified by ECMAScript
  • Constructor Details

    • DoubleCoreSerializer

      public DoubleCoreSerializer()
  • Method Details

    • serialize

      public static String serialize(double value, boolean ecmaOriginalMode)
      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 formatted
      ecmaOriginalMode - If true use EcmaScript notation. If false 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