ArrayFoldrFloatSumTest
`Array.foldr (+) 0.0` sums an `Array Float` of 1.5, 2.5 and 3.0 to exactly 7.0. The sum is logged as `7`, and compared with `7.0` to check it is the exact value.
Results
elm-0.19.1
passran in 70 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: 7 match: True
elm-0.19.2
passran in 55 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: 7 match: True
elm-0.19.3
passran in 44 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. result: 7 match: True
lamdera-1.5.0
passran in 71 msOutput
result: 7 match: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ArrayFoldrFloatSumTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ArrayFoldrFloatSumTest exposing (main)
{-| `Array.foldr (+) 0.0` sums an `Array Float` of 1.5, 2.5 and 3.0 to exactly 7.0.
The sum is logged as `7`, and compared with `7.0` to check it is the exact value.
-}
-- CHECK: result: 7
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
result =
Array.foldr (+) 0.0 (Array.fromList [ 1.5, 2.5, 3.0 ])
_ =
Debug.log "result" result
_ =
Debug.log "match" (result == 7.0)
in
text "done"