Commit graph

7 commits

Author SHA1 Message Date
Ruud van Asseldonk
7a36947dfb Clean up and clarify Number docs 2025-02-25 20:38:05 +01:00
Ruud van Asseldonk
9030ffd528 Store decimal point and exponent separately
This enables us treat numbers with an exponent losslessly. We don't
conflate the decimal point with the exponent in case they get in the
way of each other.

It also greatly simplifies the formatting. We can mechanically format
the representation now, without having to use heuristics for when to
switch to scientific notation. The catch is of course that the
heuristics will need to move elsewhere. We'll have to normalize the
numbers after arithmetic operations.
2025-02-24 20:42:59 +01:00
Ruud van Asseldonk
25df5c8f3b Clarify the documentation for number types 2025-02-24 20:42:59 +01:00
Ruud van Asseldonk
8cc1f263d8 Begin writing docs for the new Number type
I decided, after going through a few iterations of a blog post that
explains the trade-offs, to have only a single Number type, and to
remove Int. This is an invasive change, let's start with the docs
because those are somewhat easier.
2025-02-24 20:42:59 +01:00
Ruud van Asseldonk
684efd8a9b Write and extend some docs on numbers
I thought I was close to having a finished design, but re-reading what
I wrote before ... there are still some loose ends, like the comparison
operator now behaving very unexpectedly. Maybe I should ban cross-value
comparisons after all, and move that to a different function?
2025-02-24 20:42:59 +01:00
Ruud van Asseldonk
85b7bb0df2 Explain more about why floats are hard design-wise 2025-02-24 20:42:59 +01:00
Ruud van Asseldonk
c1dee506de Begin writing up design choices for numbers
I realized yesterday, the interaction between Int and Float creates a
rabbit hole of subtleties. I wrote down some thoughts on GitHub, but
important decisions like these are best kept under source control.
2025-02-24 20:42:59 +01:00