elm-format icon indicating copy to clipboard operation
elm-format copied to clipboard

Large number gets rewritten into a different number

Open Janiczek opened this issue 5 years ago • 4 comments

While investigating around #688 I found this: 9223372036854776000 (which is what gets returned from elm repl as a value of the max hex integer parsable by Elm - 0x7FFFFFFFFFFFFFFF) gets rewritten by elm-format into -9223372036854775616

Janiczek avatar Aug 24 '20 20:08 Janiczek

Thanks! I'll look into this at the same time. I think there's a point where if elm-compiler actually is interpreting things this way, then it may not be an issue with elm-format.

avh4 avatar Aug 24 '20 21:08 avh4

Related https://github.com/avh4/elm-format/issues/635

harrysarson avatar Aug 24 '20 21:08 harrysarson

Hmm, interesting, according to Elm 0.19, (9223372036854776000 == -9223372036854775616) is True.

avh4 avatar Sep 14 '20 21:09 avh4

Yeah, so 9223372036854776000 in an Elm source file will result in elm-compiler producing the value -9223372036854775616 in the compiled javascript. So I think this is not a bug in elm-format; elm-format is replacing what was typed with what the compiler will actually interpret it as, so I think that's correct until this changes in elm-compiler.

avh4 avatar Sep 14 '20 21:09 avh4