Results / elm-parser /
ParserIssue58FloatAboveMaxIntTest
Tags:elm19-bug
Issue: elm/parser#58
`Parser.float` loses precision on integral literals above 2^53. <https://github.com/elm/parser/issues/58> 18014398509610716 is exactly representable as a Float, and `String.toFloat` reads it exactly. Elm 0.19.1 (elm/parser 1.1.0) accumulates the digits as an Int and returns 18014398509610720.
Results
elm-0.19.1
failran in 59 msMissing pattern: parser: Ok 18014398509610716 --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. toFloat: Just 18014398509610716 parser: Ok 18014398509610720
elm-0.19.2
failran in 77 msMissing pattern: parser: Ok 18014398509610716 --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. toFloat: Just 18014398509610716 parser: Ok 18014398509610720
elm-0.19.3
failran in 63 msMissing pattern: parser: Ok 18014398509610716 --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. toFloat: Just 18014398509610716 parser: Ok 18014398509610720
lamdera-1.5.0
failran in 74 msMissing pattern: parser: Ok 18014398509610716 --- output --- toFloat: Just 18014398509610716 parser: Ok 18014398509610720
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-parser/ParserIssue58FloatAboveMaxIntTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ParserIssue58FloatAboveMaxIntTest exposing (main)
{-| `Parser.float` loses precision on integral literals above 2^53.
<https://github.com/elm/parser/issues/58>
18014398509610716 is exactly representable as a Float, and `String.toFloat` reads it exactly.
Elm 0.19.1 (elm/parser 1.1.0) accumulates the digits as an Int and returns 18014398509610720.
-}
-- TAGS: elm19-bug
-- CHECK: toFloat: Just 18014398509610716
-- CHECK: parser: Ok 18014398509610716
import Html exposing (text)
import Parser
main =
let
_ =
Debug.log "toFloat" (String.toFloat "18014398509610716")
_ =
Debug.log "parser" (Parser.run Parser.float "18014398509610716")
in
text "done"