DecodeFloat64BETest
`Bytes.Decode.float64 BE` reads back a 64-bit big-endian float written by `Bytes.Encode.float64 BE`, with every digit of `3.141592653589793` intact.
Results
elm-0.19.1
passran in 62 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. DecodeFloat64BETest: 3.141592653589793
elm-0.19.2
passran in 71 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. DecodeFloat64BETest: 3.141592653589793
elm-0.19.3
passran in 59 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. DecodeFloat64BETest: 3.141592653589793
lamdera-1.5.0
passran in 57 msOutput
DecodeFloat64BETest: 3.141592653589793
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-bytes/DecodeFloat64BETest] in its title.
Source
The -- CHECK: lines give the expected output.
module DecodeFloat64BETest exposing (main)
{-| `Bytes.Decode.float64 BE` reads back a 64-bit big-endian float written by `Bytes.Encode.float64 BE`, with every digit of `3.141592653589793` intact.
-}
-- CHECK: DecodeFloat64BETest: 3.141592653589793
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Decode as D
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.float64 BE 3.141592653589793)
result =
D.decode (D.float64 BE) bytes
|> Maybe.withDefault 0.0
_ =
Debug.log "DecodeFloat64BETest" result
in
text (String.fromFloat result)