summaryrefslogtreecommitdiff
path: root/notes/250329-numbers.md
diff options
context:
space:
mode:
Diffstat (limited to 'notes/250329-numbers.md')
-rw-r--r--notes/250329-numbers.md27
1 files changed, 26 insertions, 1 deletions
diff --git a/notes/250329-numbers.md b/notes/250329-numbers.md
index 6507a67..5bbfde3 100644
--- a/notes/250329-numbers.md
+++ b/notes/250329-numbers.md
@@ -1,11 +1,15 @@
+# Number tower
+_2025 March_
+
+```
exacts:
uint : 0...n
sint : -n...-1 | uint
- ratn : ( p: sint, q: sint )
+ ratn : ( p: sint, q: uint )
comp : ( r: ratn, i: ratn )
@@ -43,3 +47,24 @@ inexact operations:
double + double = double
cmp128 + double = cmp128 [ cmp128 + ( r = double , i = 0 ) ]
+```
+
+_2025 December_
+
+Mixing exact and inexact numbers implicitly should not be allowed. It
+should be a type error. Conversion must be explicit.
+
+Basically there are two numeric towers, not one. The exact numbers
+use integers all the way down; for example, an exact complex is a pair
+of exact rationals which are each a pair of integers. Inexact numbers
+use double, with the only other type being `complex128` which is a
+pair of doubles.
+
+Not sure yet how exactly to deal with unsigned integers. All I know
+is that I don't want there to be unsigned rational numbers; that's
+just excessive. A rational number always has a signed numerator and
+an unsigned denominator.
+
+See also:
+
+https://www.deinprogramm.de/sperber/papers/numerical-tower.pdf