Float arithmetic is subject to this kind of issues. If I had to count the number of digits of a number, I’d use recursive integer division by 10 such as https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods/
mattpiz
2
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Bug in trig functions | 3 | 1091 | December 8, 2018 | |
| JavaScript Rounding Errors Inherited by Elm | 10 | 1697 | October 14, 2019 | |
| Truncate vs. floor | 1 | 750 | January 5, 2018 | |
| Elm-natural 1.0.1: Performance improvements | 1 | 761 | March 29, 2023 | |
| Announcing elm-integer | 1 | 518 | December 4, 2023 |