sumerian-math
v1.0.0
Published
Sumerian/Babylonian base-60 math: cuneiform rendering, sexagesimal notation parsing, IGI reciprocal table, and the Babylonian square root algorithm
Maintainers
Readme
sumerian-math 𒁹 𒌋𒌋𒐉 𒐐𒁹 𒌋
Sumerian/Babylonian base-60 mathematics in pure JavaScript — no dependencies, ESM, works in Node 18+ and every modern browser.
Extracted from SumerianMath 3D, an interactive 3D scribe workshop.
Install
npm install sumerian-mathUsage
import {
decimalToSexagesimalDigits,
sexagesimalDigitsToDecimal,
decimalToCuneiform,
decimalToSexagesimalFraction,
parseSexagesimalNotation,
isRegularNumber,
computeBabylonianSquareRoot,
BABYLONIAN_RECIPROCALS,
} from 'sumerian-math';
// Integers ↔ base-60 places
decimalToSexagesimalDigits(405798); // [1, 52, 43, 18]
sexagesimalDigitsToDecimal([2, 15]); // 135
// Straight to cuneiform
decimalToCuneiform(75); // '𒁹 𒌋𒁹𒁹𒁹𒁹𒁹' (1,15)
// Fractions and academic notation
decimalToSexagesimalFraction(Math.SQRT2, 3).notation; // '1 ; 24, 51, 10'
parseSexagesimalNotation('1 ; 24, 51, 10'); // 1.4142129629629...
// Which divisors terminate in base 60?
isRegularNumber(54); // true (54 = 2·3³, so 1/54 terminates)
isRegularNumber(7); // false (1/7 repeats forever, even for Babylonians)
// Division the Babylonian way: multiply by the reciprocal (IGI)
const igi8 = BABYLONIAN_RECIPROCALS.find(r => r.n === 8);
igi8.notation; // '0 ; 7, 30' (1/8 = 7/60 + 30/3600)
// Babylonian square root of 2 (the YBC 7289 value), starting from 1.5
computeBabylonianSquareRoot(2, 1.5, 3).at(-1).sexagesimal; // '1 ; 24, 51, 10'API
| Export | Description |
|--------|-------------|
| numberToWedges(n) | Splits a digit 0–59 into tens/ones with Unicode cuneiform and ASCII output |
| decimalToSexagesimalDigits(n) | Integer → base-60 digit array, highest place first |
| sexagesimalDigitsToDecimal(digits) | Base-60 digit array → integer |
| decimalToCuneiform(n) | Integer → cuneiform string, places separated by spaces |
| formatSexagesimal(digits) | Digit array → '2, 15' notation |
| decimalToSexagesimalFraction(val, precision) | Float → a ; b, c, d notation with fractional places |
| parseSexagesimalNotation(str) | '1 ; 24, 51, 10' → decimal float |
| isRegularNumber(n) | True for 5-smooth numbers (terminating base-60 reciprocals) |
| computeBabylonianSquareRoot(S, guess, steps) | Iteration trace of xₙ₊₁ = ½(xₙ + S/xₙ) |
| BABYLONIAN_RECIPROCALS | The standard reciprocal (IGI) table of regular numbers |
| CUNEIFORM_GLYPHS | Unicode cuneiform signs for digits and operations |
Notation
Sexagesimal places are separated by commas, and the fractional point by a semicolon, following standard Assyriological convention:
1;24,51,10 = 1 + 24/60 + 51/60² + 10/60³ ≈ 1.41421296