RoundTripFloatTest
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 msOutput
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 msOutput
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 msOutput
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 msOutput
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"