EqualityFloatViaSetTest
`List.member` finds `Float` values in a list correctly. `List.member` compares with `==`. Searching `[0.0, 1.5, 2.25, 3.0, 5.5]` finds 2.25 and 0.0 and does not find 9.99.
Results
elm-0.19.1
passran in 60 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. present: True absent: False zero_present: True
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. present: True absent: False zero_present: True
elm-0.19.3
passran in 37 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. zero_present: True absent: False present: True
lamdera-1.5.0
passran in 52 msOutput
zero_present: True absent: False present: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/EqualityFloatViaSetTest] in its title.
Source
The -- CHECK: lines give the expected output.
module EqualityFloatViaSetTest exposing (main)
{-| `List.member` finds `Float` values in a list correctly.
`List.member` compares with `==`. Searching `[0.0, 1.5, 2.25, 3.0, 5.5]` finds
2.25 and 0.0 and does not find 9.99.
-}
-- CHECK: present: True
-- CHECK: absent: False
-- CHECK: zero_present: True
import Html exposing (text)
main =
let
xs : List Float
xs =
[ 0.0, 1.5, 2.25, 3.0, 5.5 ]
_ =
Debug.log "present" (List.member 2.25 xs)
_ =
Debug.log "absent" (List.member 9.99 xs)
_ =
Debug.log "zero_present" (List.member 0.0 xs)
in
text "done"