[D66] Duodecimal python library [new]
René Oudeweg
roudeweg at gmail.com
Sat Jan 3 03:00:05 CET 2026
> === Duodecimal Arithmetic Demonstration ===
>
> 1) Division by 3 (exact in base-12):
> 1 / 3 = 0.4
> As decimal: 0.3333333333333333
> (1/3) × 3 = 1
> Equal to 1? True
>
> 2) Division by 4 (exact in base-12):
> 1 / 4 = 0.3
> (1/4) × 4 = 1
>
> 3) Division by 5 (infinite in base-12, like 1/3 in decimal):
> 1 / 5 = 0.24972497249724X08101
> As decimal: 0.19999999999999998
> (1/5) × 5 = 1.00000000000000234505
> Equal to 1? False
>
> 4) Basic arithmetic:
> X.6 + 3.4 = 11.X
> X.6 - 3.4 = 7.2
> X.6 × 3.4 = 2E
>
> 5) Base-12 handles 0.1₁₀ differently:
> 0.1₁₀ in base-12: 0.1249724972497250406
> 0.2₁₀ in base-12: 0.24972497249724X08101
> Sum: 0.37249724972497310161
> Back to decimal: 0.3
On 1/3/26 02:56, René Oudeweg wrote:
> [Deze implementatie bestond nog niet...]
>
> https://github.com/juggao/duodecimal/tree/main
>
>
> I've created a native base-12 arithmetic library that stores and
> computes numbers entirely in duodecimal representation! Here are the key
> features:
>
> Core Capabilities:
>
> * Native Base-12 Storage: Numbers stored as lists of digits [0-11],
> using 'X' for 10 and 'E' for 11
> * All Four Basic Operations: Addition, subtraction, multiplication, and
> division implemented in pure base-12
> * Configurable Precision: Context-based precision control (like Python's
> decimal module)
> * Multiple Input Formats: Can create from base-12 strings, decimals, or
> other Duodecimal objects
>
> Key Advantages Demonstrated:
>
> 1/3 is exact: Duodecimal("1") / Duodecimal("3") gives exactly 0.4 in
> base-12
> 1/4 is exact: Perfect representation (unlike some bases)
> 1/6 terminates: Another advantage of 12's factorization
>
> The Tradeoff:
>
> 1/5 becomes infinite in base-12, just like 1/3 is infinite in decimal
> This demonstrates that no base eliminates rounding—it only shifts which
> fractions terminate.
>
>
More information about the D66
mailing list