Elm Exactly
Results / elm-json /

RoundTripFloatTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
The float 3.14 encoded with `Json.Encode.float` decodes back to 3.14 with `Json.Decode.float`.

Results

elm-0.19.1

passran in 46 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rt_float: Ok 3.14

elm-0.19.2

passran in 38 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rt_float: Ok 3.14

elm-0.19.3

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rt_float: Ok 3.14

lamdera-1.5.0

passran in 60 ms
Output
rt_float: Ok 3.14

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-json/RoundTripFloatTest] in its title.

Source

The -- CHECK: lines give the expected output.

module RoundTripFloatTest exposing (main)
{-| The float 3.14 encoded with `Json.Encode.float` decodes back to 3.14 with `Json.Decode.float`.
-}
-- CHECK: rt_float: Ok 3.14
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
_ = Debug.log "rt_float" (Decode.decodeString Decode.float (Encode.encode 0 (Encode.float 3.14)))
in
text "done"