From da908fb807b87a22ed68285fe08daaf828cfb17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Bystr=C3=B6m=20Ericsson?= Date: Wed, 18 Dec 2024 09:10:10 +0100 Subject: [PATCH] The arbitrary bit `Count` unification README.md section (#114). --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53669336..f5bb2c37 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - [The `Fallible` redemption arc](#overview-the-fallible-redemption-arc) - [The precondition `Guarantee` types](#overview-the-precondition-guarantee-types) - [The magic `Divider` constants](#overview-the-magic-divider-constants) + - [The arbitrary bit `Count` unification](#overview-the-arbitrary-bit-count-unification) @@ -113,8 +114,6 @@ This setup enables optimizations and omits unrelated metrics. These steps are cr ### The overpowered `BinaryInteger` -๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ› ๏ธ๐Ÿšง๐Ÿงฑ๐Ÿงฑ๐Ÿ—๏ธ๐Ÿงฑ๐Ÿงฑ๐Ÿšงโณ - ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Systems โ”‚ Arbitrary โ”‚ @@ -297,3 +296,17 @@ let typical = U8.division(random, by: divisor) as Fallible> let magical = U8.division(random, by: divider) as Fallible> precondition(typical == magical) // quotient, remainder, and error indicator ``` + + + +### The arbitrary bit `Count` unification + +> Please roll a D20 arcana check. + +An arbitrary integer's bit pattern extends infinitely, yet its bit pattern has an end. It must be this way, or it would not behave like its systems integer friends. As such, we need a different model to represent arbitrary integer sizes. `Count` fulfills our need by reinterpreting the last bit of a machine word as logarithmically infinite. + +``` +UXL.max = &0 +min ..< msb: [0, IX.max + 0] +msb ... max: [โˆž - IX.max, โˆž] โ‰ค log2(&0+1) +```