From: Ian Jackson Date: Tue, 6 Oct 2020 20:19:46 +0000 (+0100) Subject: document new plan X-Git-Tag: otter-0.2.0~733 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c8838809e2ffc59038d5941e85683ef0de979705;p=otter.git document new plan Signed-off-by: Ian Jackson --- diff --git a/templates/bigfloat.ts b/templates/bigfloat.ts index 43c8f79a..28552d1a 100644 --- a/templates/bigfloat.ts +++ b/templates/bigfloat.ts @@ -28,34 +28,43 @@ // 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;