Elm Exactly

Rule 156e-dec-float

DecodingDecτ(j)=v\Dec{\tau}(j)=v
j∈JNumDecFloat(j)=float(j)\frac{\begin{array}{c}j\in\effJNum\end{array}}{\begin{array}{c}\Dec{\tFloat}(j)=\efffloat(j)\end{array}}
(156)
Read it in its chapter·Permanent address: /standard/rules/e-dec-float

Comments

Every JSON number decodes, integers among them, as the nearest floating-point number. A number too large for a finite floating-point number decodes as the infinity of its sign, by the rounding of floating-point constants. An incoming −0-0 is the number 00, and decodes as the float 00, not −0-0. No boundary value decodes as NaN.

TeX source
\defnrule[r:e-dec-float]
  {j\in\effJNum}
  {\Dec{\tFloat}(j)=\efffloat(j)}

Tests (4)

  • elm / MinimalPipeFloatTest
    A pipe at `Float`: the value the driver sends in comes back out.
  • elm / PortEchoFloatTest
    A `Float` sent out through a port comes back unchanged through an incoming port, for each of seven sample values.
  • elm / PortPipeScalarsTest
    JSON numbers, Booleans, strings and `null` received at `Float`, `Int`, `Bool`, `String` and `()` go out as they came.
  • elm / StandardA88PortNegativeZeroTest
    `-0` sent out through a port arrives as `+0`.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:e-dec-float] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.