Float constant is changed to incorrect value
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Description
When I try to define a constant as
```
maxFloatAsFloat : Float
maxFloatAsFloat =
18446744073709549568.0
```
`elm-format` changes that to
```
maxFloatAsFloat : Float
maxFloatAsFloat =
18446744073709550000.0
```
This is incorrect. Value `18446744073709549568.0` can be represented **exactly** as a `Float` unlike `18446744073709550000.0`.
p.s. This is largest possible `Float` value less than `2^64`, i.e. `2^64 - 2048`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the formatting change with the Float constant shown in the issue, then trace elm-format's numeric-literal formatting path. Confirm that formatting preserves the exact value 18446744073709549568.0 rather than changing it to 18446744073709550000.0, and add or update coverage for this case if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elm, haskell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100