From 4210e8538e6e0adf3af7badeab33c619f3db9497 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Fri, 26 Dec 2025 07:09:36 +0100 Subject: Add a note, expand other notes, add dates into notes. --- notes/250329-numbers.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'notes/250329-numbers.md') 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 -- cgit v1.2.3