chiark / gitweb /
document new plan
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Oct 2020 20:19:46 +0000 (21:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Oct 2020 20:19:46 +0000 (21:19 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/bigfloat.ts

index 43c8f79aba61d375d06259ecee31317de3c3bb3c..28552d1a50d40f46d8ba5994ff0009acda207543 100644 (file)
 //   VVVVVVVVVV = 50 bits in lowercase base32hex ("0-9a-..."), unsigned
 // Value is a whole number of 50-bit groups ("limbs"), at least one sucb.
 //
+// The abstract value is completed by an infinite number of zero
+// limbs to the right.  Trailing zero limbs are forbidden in the
+// representation.
+//
 // Supported operations are:
 //
 //    Total ordering
 //       Values are compared lexically.
-//       (So, NNNN_NNNN_NNNN < NNNN_NNNN_NNNN.0000_0000_0000)
 //
 //    Select initial value:
-//       8000_0000_0000
+//       g000000000
+//
+//    Pick a value (or "n" values) strictly in between any two
+//    existing values.
 //
-//    Pick a value (or a specified number of values) strictly
-//    in between any two existing values.
+//       Find first limb that they differ.  Divide intervening values
+//       for tht limb evenly (ie divide the range by n+1).  If this
+//       leaves less than an increment of 1 per output value, do
+//       differently: choose a value halfway (rounding down) for the
+//       first differeing limb, and add a new limb, whose whole range
+//       0000000000..vvvvvvvvvv is divided evenly into n+1 (thus
+//       guaranteeing that the added limb is nonzero).
 //
-//       Find first limb that they differ, divide intervening
-//       limb values evenly; if this is less than an increment
-//       of 1 per limb, choose a halfway value rounding down,
-//       and add a limb
-//       
-
-the space up
-//       
+//    Pick a value later than a specified value.
 //
-//    Pick a value earlier or later than a specified value.
+//       Try to add delta to rightmost nonzero limb, with carry.  If
+//       this would overflow top limb, start again: add two limbs
+//       0000000000 and then redo (this guarantees that one of the
+//       added limbs iis nonzero).  Delta is 0001000000.
 //
-// 
-// Value represented is
-//    0x0.VVVV...VVVV * 2^0xEEEE
-//  - 0x1.0           * 2^0eEEEE if S is !
+//    Pick a value earlier than a specified value.
 //
+//       Try to subtract delta from rightmost nonzero limb, with
+//       borrow.  If this would underflow, or would leave leftmost
+//       limb equal to 0000000000, start again: decrement rightmost
+//       nonzero limb by 1, with borrow, then add two limbs
+//       vvvvvvvvvv, and redo.
 
 type Bigfloat = Bigfloats.Packed;