EncodeFloat32LETest
`Bytes.Encode.float32` with little-endian order writes 4 bytes. The test encodes `3.14159` and logs the width of the result.
Results
elm-0.19.1
passran in 55 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. EncodeFloat32LETest: 4
elm-0.19.2
passran in 66 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. EncodeFloat32LETest: 4
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. EncodeFloat32LETest: 4
lamdera-1.5.0
passran in 66 msOutput
EncodeFloat32LETest: 4
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-bytes/EncodeFloat32LETest] in its title.
Source
The -- CHECK: lines give the expected output.
module EncodeFloat32LETest exposing (main)
{-| `Bytes.Encode.float32` with little-endian order writes 4 bytes.
The test encodes `3.14159` and logs the width of the result.
-}
-- CHECK: EncodeFloat32LETest: 4
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.float32 LE 3.14159)
result =
Bytes.width bytes
_ =
Debug.log "EncodeFloat32LETest" result
in
text (String.fromInt result)