@danielsimonjr/mathts-core 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -17,6 +17,8 @@ export { addScalar, subtractScalar, multiplyScalar, divideScalar, pow, abs, fix,
17
17
  export type { NumericScalar } from './arithmetic/scalar.js';
18
18
  export { Unit, isUnit as isUnitValue, DimensionMismatchError, UnitParseError, DIMENSIONLESS, dim, } from './types/unit.js';
19
19
  export type { Dimensions, UnitDef, UnitInstance } from './types/unit.js';
20
+ export { UNIT_EXACT_SCALE, PI_EXACT_SCALE, LN2_EXACT_SCALE, NAMED_IRRATIONALS, namedIrrationalScale, irrationalPower, isRationalScale, decimalExactScale, exactScaleOf, binaryExactScale, ratioExactScale, multiplyExactScales, divideExactScales, powerExactScale, addExactScales, exactScalesEqual, exactScaleToNumber, clearExactScaleNumberCache, exactScaleNumberCacheSize, formatExactScale, readScaleExpression, NAMED_SCALES, UNIT_ROWS, UNIT_ROW_ALIASES, namedExactScale, readUnitScale, getUnitRow, unitRowExactScale, unitRowValue, unitRowExactOffset, UNIT_PREFIX_SETS, unitPrefixExactScale, getUnitPrefix, } from './types/unit.js';
21
+ export type { ExactScale, IrrationalName, IrrationalPowers, UnitRow, UnitBaseKey, UnitPrefixSetKey, UnitPrefix, } from './types/unit.js';
20
22
  export { UNIT_DIMENSION_LENGTH, SI_DIMENSION_LENGTH, toSiDimensions, toSiDimensionVector, fromSiDimensions, fromSiDimensionVector, } from './types/unit.js';
21
23
  export type { SiDimensionVector, SiDimensionOptions } from './types/unit.js';
22
24
  export { BASE_UNITS, DERIVED_UNITS, ALL_UNITS, UNIT_ALIASES, getUnitDef, } from './types/unit-definitions.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,YAAY,EACV,WAAW,EACX,MAAM,EACN,WAAW,EAC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NIT_PREFIX_SETS,
30
+ UNIT_ROWS,
31
+ UNIT_ROW_ALIASES,
24
32
  Unit,
25
33
  UnitParseError,
26
34
  abs,
35
+ addExactScales,
27
36
  addScalar,
37
+ binaryExactScale,
38
+ clearExactScaleNumberCache,
39
+ decimalExactScale,
40
+ divideExactScales,
28
41
  divideScalar,
29
42
  equal,
43
+ exactScaleNumberCacheSize,
44
+ exactScaleOf,
45
+ exactScaleToNumber,
46
+ exactScalesEqual,
30
47
  factory,
31
48
  fix,
32
49
  format,
50
+ formatExactScale,
51
+ getUnitPrefix,
52
+ getUnitRow,
53
+ irrationalPower,
33
54
  isBigInt,
34
55
  isBigNumber,
35
56
  isBigNumber2,
36
57
  isComplex2 as isComplex,
37
58
  isFraction2 as isFraction,
38
59
  isNumeric,
60
+ isRationalScale,
39
61
  isUnit,
62
+ multiplyExactScales,
40
63
  multiplyScalar,
64
+ namedExactScale,
65
+ namedIrrationalScale,
41
66
  nearlyEqual,
42
67
  number,
43
68
  pow,
69
+ powerExactScale,
70
+ ratioExactScale,
71
+ readScaleExpression,
72
+ readUnitScale,
44
73
  round,
45
74
  sign,
46
- subtractScalar
47
- } from "./chunk-MBKU4LYX.js";
75
+ subtractScalar,
76
+ unitPrefixExactScale,
77
+ unitRowExactOffset,
78
+ unitRowExactScale,
79
+ unitRowValue
80
+ } from "./chunk-UEBMU6EV.js";
48
81
 
49
82
  // src/types/matrix/Range.ts
50
83
  var name = "Range";
@@ -530,116 +563,99 @@ var BASE_UNITS = {
530
563
  mol: { multiplier: 1, dimensions: dim({ amount: 1 }), prefixable: true },
531
564
  cd: { multiplier: 1, dimensions: dim({ luminosity: 1 }), prefixable: true }
532
565
  };
566
+ function tableUnit(name2, dimensions, prefixable) {
567
+ const row = getUnitRow(name2);
568
+ if (row === void 0) throw new Error(`unit-definitions: '${name2}' is not in the unit table`);
569
+ const scale = readUnitScale(row.scale);
570
+ const def = { multiplier: exactScaleToNumber(scale), dimensions };
571
+ if (row.offset !== void 0) {
572
+ def.offset = exactScaleToNumber(multiplyExactScales(scale, readUnitScale(row.offset)));
573
+ }
574
+ if (prefixable) def.prefixable = true;
575
+ return def;
576
+ }
533
577
  var DERIVED_UNITS = {
534
578
  // --- Length ---------------------------------------------------------------
535
579
  // Note: 'm' is a base unit (above), already prefixable.
536
- ft: { multiplier: 0.3048, dimensions: dim({ length: 1 }) },
537
- foot: { multiplier: 0.3048, dimensions: dim({ length: 1 }) },
538
- in: { multiplier: 0.0254, dimensions: dim({ length: 1 }) },
539
- inch: { multiplier: 0.0254, dimensions: dim({ length: 1 }) },
540
- yd: { multiplier: 0.9144, dimensions: dim({ length: 1 }) },
541
- yard: { multiplier: 0.9144, dimensions: dim({ length: 1 }) },
542
- mi: { multiplier: 1609.344, dimensions: dim({ length: 1 }) },
543
- mile: { multiplier: 1609.344, dimensions: dim({ length: 1 }) },
580
+ ft: tableUnit("ft", dim({ length: 1 })),
581
+ foot: tableUnit("foot", dim({ length: 1 })),
582
+ in: tableUnit("in", dim({ length: 1 })),
583
+ inch: tableUnit("inch", dim({ length: 1 })),
584
+ yd: tableUnit("yd", dim({ length: 1 })),
585
+ yard: tableUnit("yard", dim({ length: 1 })),
586
+ mi: tableUnit("mi", dim({ length: 1 })),
587
+ mile: tableUnit("mile", dim({ length: 1 })),
544
588
  // --- Mass -----------------------------------------------------------------
545
589
  // The "g" entry is gram (0.001 kg). It is prefixable, so kg/mg/µg work via
546
590
  // prefix application on this entry rather than the base "kg".
547
- g: { multiplier: 1e-3, dimensions: dim({ mass: 1 }), prefixable: true },
548
- lb: { multiplier: 0.45359237, dimensions: dim({ mass: 1 }) },
549
- lbm: { multiplier: 0.45359237, dimensions: dim({ mass: 1 }) },
550
- oz: { multiplier: 0.028349523125, dimensions: dim({ mass: 1 }) },
551
- ton: { multiplier: 907.18474, dimensions: dim({ mass: 1 }) },
591
+ g: tableUnit("g", dim({ mass: 1 }), true),
592
+ lb: tableUnit("lb", dim({ mass: 1 })),
593
+ lbm: tableUnit("lbm", dim({ mass: 1 })),
594
+ oz: tableUnit("oz", dim({ mass: 1 })),
595
+ ton: tableUnit("ton", dim({ mass: 1 })),
552
596
  // US short ton
553
- tonne: { multiplier: 1e3, dimensions: dim({ mass: 1 }) },
597
+ tonne: tableUnit("tonne", dim({ mass: 1 })),
554
598
  // metric ton
555
599
  // --- Time -----------------------------------------------------------------
556
- min: { multiplier: 60, dimensions: dim({ time: 1 }) },
557
- h: { multiplier: 3600, dimensions: dim({ time: 1 }) },
558
- hr: { multiplier: 3600, dimensions: dim({ time: 1 }) },
559
- day: { multiplier: 86400, dimensions: dim({ time: 1 }) },
560
- week: { multiplier: 604800, dimensions: dim({ time: 1 }) },
561
- year: { multiplier: 31557600, dimensions: dim({ time: 1 }) },
600
+ min: tableUnit("min", dim({ time: 1 })),
601
+ h: tableUnit("h", dim({ time: 1 })),
602
+ hr: tableUnit("hr", dim({ time: 1 })),
603
+ day: tableUnit("day", dim({ time: 1 })),
604
+ week: tableUnit("week", dim({ time: 1 })),
605
+ year: tableUnit("year", dim({ time: 1 })),
562
606
  // Julian year
563
607
  // --- Temperature ----------------------------------------------------------
564
608
  // K is the base.
565
609
  // °C → K is offset by 273.15 (no multiplicative factor change).
566
610
  // °F → K is more complex (offset & scale).
567
- degC: { multiplier: 1, offset: 273.15, dimensions: dim({ temperature: 1 }) },
568
- degF: { multiplier: 5 / 9, offset: 459.67 * (5 / 9), dimensions: dim({ temperature: 1 }) },
569
- degR: { multiplier: 5 / 9, dimensions: dim({ temperature: 1 }) },
611
+ degC: tableUnit("degC", dim({ temperature: 1 })),
612
+ degF: tableUnit("degF", dim({ temperature: 1 })),
613
+ degR: tableUnit("degR", dim({ temperature: 1 })),
570
614
  // Rankine
571
615
  // --- Plane angle (dimensionless, but often treated as units) --------------
572
- rad: { multiplier: 1, dimensions: dim({}), prefixable: true },
573
- deg: { multiplier: Math.PI / 180, dimensions: dim({}) },
574
- grad: { multiplier: Math.PI / 200, dimensions: dim({}) },
616
+ rad: tableUnit("rad", dim({}), true),
617
+ deg: tableUnit("deg", dim({})),
618
+ grad: tableUnit("grad", dim({})),
575
619
  // --- Force ----------------------------------------------------------------
576
620
  // N = kg·m·s^-2 = 1 kg·m·s^-2; in our base-units representation that's
577
621
  // value=1, dim {length: 1, mass: 1, time: -2}.
578
- N: { multiplier: 1, dimensions: dim({ length: 1, mass: 1, time: -2 }), prefixable: true },
579
- dyn: { multiplier: 1e-5, dimensions: dim({ length: 1, mass: 1, time: -2 }) },
580
- lbf: { multiplier: 4.4482216152605, dimensions: dim({ length: 1, mass: 1, time: -2 }) },
622
+ N: tableUnit("N", dim({ length: 1, mass: 1, time: -2 }), true),
623
+ dyn: tableUnit("dyn", dim({ length: 1, mass: 1, time: -2 })),
624
+ lbf: tableUnit("lbf", dim({ length: 1, mass: 1, time: -2 })),
581
625
  // --- Energy ---------------------------------------------------------------
582
- J: { multiplier: 1, dimensions: dim({ length: 2, mass: 1, time: -2 }), prefixable: true },
583
- erg: { multiplier: 1e-7, dimensions: dim({ length: 2, mass: 1, time: -2 }) },
584
- cal: { multiplier: 4.184, dimensions: dim({ length: 2, mass: 1, time: -2 }) },
585
- eV: {
586
- multiplier: 1602176634e-28,
587
- dimensions: dim({ length: 2, mass: 1, time: -2 }),
588
- prefixable: true
589
- },
590
- BTU: { multiplier: 1055.05585262, dimensions: dim({ length: 2, mass: 1, time: -2 }) },
626
+ J: tableUnit("J", dim({ length: 2, mass: 1, time: -2 }), true),
627
+ erg: tableUnit("erg", dim({ length: 2, mass: 1, time: -2 })),
628
+ cal: tableUnit("cal", dim({ length: 2, mass: 1, time: -2 })),
629
+ eV: tableUnit("eV", dim({ length: 2, mass: 1, time: -2 }), true),
630
+ BTU: tableUnit("BTU", dim({ length: 2, mass: 1, time: -2 })),
591
631
  // --- Power ----------------------------------------------------------------
592
- W: { multiplier: 1, dimensions: dim({ length: 2, mass: 1, time: -3 }), prefixable: true },
593
- hp: { multiplier: 745.6998715822702, dimensions: dim({ length: 2, mass: 1, time: -3 }) },
632
+ W: tableUnit("W", dim({ length: 2, mass: 1, time: -3 }), true),
633
+ hp: tableUnit("hp", dim({ length: 2, mass: 1, time: -3 })),
594
634
  // --- Pressure -------------------------------------------------------------
595
- Pa: { multiplier: 1, dimensions: dim({ length: -1, mass: 1, time: -2 }), prefixable: true },
596
- bar: { multiplier: 1e5, dimensions: dim({ length: -1, mass: 1, time: -2 }), prefixable: true },
597
- atm: { multiplier: 101325, dimensions: dim({ length: -1, mass: 1, time: -2 }) },
598
- psi: { multiplier: 6894.757293168361, dimensions: dim({ length: -1, mass: 1, time: -2 }) },
599
- torr: { multiplier: 133.322368421, dimensions: dim({ length: -1, mass: 1, time: -2 }) },
600
- mmHg: { multiplier: 133.322387415, dimensions: dim({ length: -1, mass: 1, time: -2 }) },
635
+ Pa: tableUnit("Pa", dim({ length: -1, mass: 1, time: -2 }), true),
636
+ bar: tableUnit("bar", dim({ length: -1, mass: 1, time: -2 }), true),
637
+ atm: tableUnit("atm", dim({ length: -1, mass: 1, time: -2 })),
638
+ psi: tableUnit("psi", dim({ length: -1, mass: 1, time: -2 })),
639
+ torr: tableUnit("torr", dim({ length: -1, mass: 1, time: -2 })),
640
+ mmHg: tableUnit("mmHg", dim({ length: -1, mass: 1, time: -2 })),
601
641
  // --- Electric -------------------------------------------------------------
602
- C: {
603
- multiplier: 1,
604
- dimensions: dim({ time: 1, current: 1 }),
605
- prefixable: true
606
- },
607
- V: {
608
- multiplier: 1,
609
- dimensions: dim({ length: 2, mass: 1, time: -3, current: -1 }),
610
- prefixable: true
611
- },
612
- ohm: {
613
- multiplier: 1,
614
- dimensions: dim({ length: 2, mass: 1, time: -3, current: -2 }),
615
- prefixable: true
616
- },
617
- \u03A9: {
618
- multiplier: 1,
619
- dimensions: dim({ length: 2, mass: 1, time: -3, current: -2 }),
620
- prefixable: true
621
- },
622
- F: {
623
- multiplier: 1,
624
- dimensions: dim({ length: -2, mass: -1, time: 4, current: 2 }),
625
- prefixable: true
626
- },
627
- H: {
628
- multiplier: 1,
629
- dimensions: dim({ length: 2, mass: 1, time: -2, current: -2 }),
630
- prefixable: true
631
- },
642
+ C: tableUnit("C", dim({ time: 1, current: 1 }), true),
643
+ V: tableUnit("V", dim({ length: 2, mass: 1, time: -3, current: -1 }), true),
644
+ ohm: tableUnit("ohm", dim({ length: 2, mass: 1, time: -3, current: -2 }), true),
645
+ \u03A9: tableUnit("ohm", dim({ length: 2, mass: 1, time: -3, current: -2 }), true),
646
+ F: tableUnit("F", dim({ length: -2, mass: -1, time: 4, current: 2 }), true),
647
+ H: tableUnit("H", dim({ length: 2, mass: 1, time: -2, current: -2 }), true),
632
648
  // --- Frequency ------------------------------------------------------------
633
- Hz: { multiplier: 1, dimensions: dim({ time: -1 }), prefixable: true },
649
+ Hz: tableUnit("Hz", dim({ time: -1 }), true),
634
650
  // --- Volume ---------------------------------------------------------------
635
- L: { multiplier: 1e-3, dimensions: dim({ length: 3 }), prefixable: true },
636
- l: { multiplier: 1e-3, dimensions: dim({ length: 3 }), prefixable: true },
637
- gal: { multiplier: 0.003785411784, dimensions: dim({ length: 3 }) },
651
+ L: tableUnit("L", dim({ length: 3 }), true),
652
+ l: tableUnit("l", dim({ length: 3 }), true),
653
+ gal: tableUnit("gal", dim({ length: 3 })),
638
654
  // US gallon
639
655
  // --- Area -----------------------------------------------------------------
640
- ha: { multiplier: 1e4, dimensions: dim({ length: 2 }) },
656
+ ha: tableUnit("hectare", dim({ length: 2 })),
641
657
  // hectare
642
- acre: { multiplier: 4046.8564224, dimensions: dim({ length: 2 }) }
658
+ acre: tableUnit("acre", dim({ length: 2 }))
643
659
  };
644
660
  var ALL_UNITS = { ...BASE_UNITS, ...DERIVED_UNITS };
645
661
  var UNIT_ALIASES = {
@@ -741,52 +757,16 @@ function fromSiDimensionVector(vector) {
741
757
  }
742
758
 
743
759
  // src/types/unit-prefixes.ts
744
- var SI_PREFIXES = {
745
- // Positive powers of ten
746
- Y: 1e24,
747
- // yotta
748
- Z: 1e21,
749
- // zetta
750
- E: 1e18,
751
- // exa
752
- P: 1e15,
753
- // peta
754
- T: 1e12,
755
- // tera
756
- G: 1e9,
757
- // giga
758
- M: 1e6,
759
- // mega
760
- k: 1e3,
761
- // kilo
762
- h: 100,
763
- // hecto
764
- da: 10,
765
- // deka (two-letter)
766
- // Negative powers of ten
767
- d: 0.1,
768
- // deci
769
- c: 0.01,
770
- // centi
771
- m: 1e-3,
772
- // milli
773
- u: 1e-6,
774
- // micro (ASCII fallback)
775
- \u00B5: 1e-6,
776
- // micro (Unicode)
777
- n: 1e-9,
778
- // nano
779
- p: 1e-12,
780
- // pico
781
- f: 1e-15,
782
- // femto
783
- a: 1e-18,
784
- // atto
785
- z: 1e-21,
786
- // zepto
787
- y: 1e-24
788
- // yocto
789
- };
760
+ var SI_PREFIXES = (() => {
761
+ const prefixes = {};
762
+ const short = UNIT_PREFIX_SETS.SHORT;
763
+ for (const name2 of Object.keys(short)) {
764
+ if (name2 === "") continue;
765
+ prefixes[name2] = exactScaleToNumber(unitPrefixExactScale(short[name2]));
766
+ }
767
+ prefixes["\xB5"] = prefixes.u;
768
+ return prefixes;
769
+ })();
790
770
  var BEST_PREFIXES = [
791
771
  "Y",
792
772
  "Z",
@@ -1473,7 +1453,7 @@ function neumaierCumsum(xs, out) {
1473
1453
  }
1474
1454
 
1475
1455
  // src/index.ts
1476
- var VERSION = "0.16.0";
1456
+ var VERSION = "0.18.0";
1477
1457
  export {
1478
1458
  ALL_UNITS,
1479
1459
  BASE_UNITS,
@@ -1509,12 +1489,16 @@ export {
1509
1489
  I,
1510
1490
  LN10,
1511
1491
  LN2,
1492
+ LN2_EXACT_SCALE,
1512
1493
  LOG10E,
1513
1494
  LOG2E,
1514
1495
  MATHTS_CONVERSIONS,
1515
1496
  MATHTS_TYPES,
1497
+ NAMED_IRRATIONALS,
1498
+ NAMED_SCALES,
1516
1499
  PHI,
1517
1500
  PI,
1501
+ PI_EXACT_SCALE,
1518
1502
  Range,
1519
1503
  SI_DIMENSION_LENGTH,
1520
1504
  SI_PREFIXES,
@@ -1524,25 +1508,42 @@ export {
1524
1508
  TypeRegistry,
1525
1509
  UNIT_ALIASES,
1526
1510
  UNIT_DIMENSION_LENGTH,
1511
+ UNIT_EXACT_SCALE,
1512
+ UNIT_PREFIX_SETS,
1513
+ UNIT_ROWS,
1514
+ UNIT_ROW_ALIASES,
1527
1515
  Unit,
1528
1516
  UnitParseError,
1529
1517
  VERSION,
1530
1518
  abs,
1519
+ addExactScales,
1531
1520
  addScalar,
1521
+ binaryExactScale,
1522
+ clearExactScaleNumberCache,
1532
1523
  create,
1533
1524
  createFactory,
1534
1525
  createMathTSTyped,
1535
1526
  createRangeClass,
1536
1527
  createTypedFunction,
1528
+ decimalExactScale,
1537
1529
  dim,
1530
+ divideExactScales,
1538
1531
  divideScalar,
1539
1532
  equal,
1533
+ exactScaleNumberCacheSize,
1534
+ exactScaleOf,
1535
+ exactScaleToNumber,
1536
+ exactScalesEqual,
1540
1537
  fix,
1538
+ formatExactScale,
1541
1539
  fromSiDimensionVector,
1542
1540
  fromSiDimensions,
1543
1541
  getPrefix,
1544
1542
  getUnitDef,
1543
+ getUnitPrefix,
1544
+ getUnitRow,
1545
1545
  initTypedWasm,
1546
+ irrationalPower,
1546
1547
  isArray,
1547
1548
  isBigInt2 as isBigInt,
1548
1549
  isBigNumber2 as isBigNumber,
@@ -1557,6 +1558,7 @@ export {
1557
1558
  isNumber,
1558
1559
  isNumeric,
1559
1560
  isObject,
1561
+ isRationalScale,
1560
1562
  isSparseMatrix,
1561
1563
  isString,
1562
1564
  isTypedWasmAvailable,
@@ -1565,7 +1567,10 @@ export {
1565
1567
  isUnit as isUnitValue,
1566
1568
  math,
1567
1569
  mathTyped,
1570
+ multiplyExactScales,
1568
1571
  multiplyScalar,
1572
+ namedExactScale,
1573
+ namedIrrationalScale,
1569
1574
  neumaierCumsum,
1570
1575
  neumaierSum,
1571
1576
  norm2,
@@ -1573,6 +1578,10 @@ export {
1573
1578
  pairwiseDot,
1574
1579
  pairwiseSum,
1575
1580
  pow,
1581
+ powerExactScale,
1582
+ ratioExactScale,
1583
+ readScaleExpression,
1584
+ readUnitScale,
1576
1585
  registerNativeTypes,
1577
1586
  registry,
1578
1587
  round,
@@ -1581,5 +1590,9 @@ export {
1581
1590
  sumSquaredDeviations,
1582
1591
  toSiDimensionVector,
1583
1592
  toSiDimensions,
1584
- typed
1593
+ typed,
1594
+ unitPrefixExactScale,
1595
+ unitRowExactOffset,
1596
+ unitRowExactScale,
1597
+ unitRowValue
1585
1598
  };
package/dist/internal.js CHANGED
@@ -78,7 +78,7 @@ import {
78
78
  typeOf,
79
79
  unitDependencies,
80
80
  warnOnce
81
- } from "./chunk-MBKU4LYX.js";
81
+ } from "./chunk-UEBMU6EV.js";
82
82
 
83
83
  // src/error/DimensionError.ts
84
84
  var DimensionError = class _DimensionError extends RangeError {
@@ -1 +1 @@
1
- {"version":3,"file":"Unit.d.ts","sourceRoot":"","sources":["../../../src/types/unit/Unit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAcV,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AAkCzB,eAAO,MAAM,eAAe,6DAgvH3B,CAAC"}
1
+ {"version":3,"file":"Unit.d.ts","sourceRoot":"","sources":["../../../src/types/unit/Unit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAcV,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AAqIzB,eAAO,MAAM,eAAe,6DAigF3B,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Exact unit scales.
3
+ *
4
+ * A unit's scale to SI is a rational number times integer powers of named
5
+ * irrationals: `num / den × Π name^k`. The names come from one registry,
6
+ * {@link NAMED_IRRATIONALS} (π and ln 2 today); adding a constant is one entry
7
+ * there. Products, quotients and integer powers stay exact, so a scale is
8
+ * rounded to a double once, at the end, by {@link exactScaleToNumber}. `psi`
9
+ * stated as `lbf/inch^2` is therefore the double nearest
10
+ * 0.45359237 × 9.80665 / 0.0254², not the result of three rounded float steps.
11
+ *
12
+ * A decimal literal (`'0.0254'`, `'1.602176634e-19'`) is read digit for digit.
13
+ * A JavaScript number is read through its shortest round-trip decimal
14
+ * (`String(x)`), which is the literal it was written as.
15
+ *
16
+ * Scale expressions (the form the unit table states its rows in) are factors
17
+ * joined by `*`, optionally followed by one `/` and the denominator's factors.
18
+ * A factor is a decimal literal, a registered irrational name, a named scale,
19
+ * or a parenthesized expression, with an optional integer power `^n`.
20
+ * Whitespace between tokens is ignored. Everything after the first `/` at one
21
+ * level is the denominator (ISO 80000-1 single-solidus reading): `a/b*c` is
22
+ * a/(b·c), and `a/(b*c)` says the same with explicit grouping.
23
+ *
24
+ * @module @danielsimonjr/mathts-core/types/unit/exact-scale
25
+ */
26
+ /**
27
+ * The named irrationals a scale may carry, each as a decimal truncated to 120
28
+ * places. Rounding `r × Π c^k` through these rationals is off from rounding the
29
+ * true value only if the true value lies within about 1e-118 (relative) of a
30
+ * midpoint between two doubles. The test files pin each entry's digits against
31
+ * an independent computation. The constants are treated as algebraically
32
+ * independent over Q (true for π and ln 2), so scales with different powers do
33
+ * not add.
34
+ */
35
+ export declare const NAMED_IRRATIONALS: Readonly<{
36
+ readonly pi: '3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647';
37
+ readonly ln2: '0.693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733';
38
+ }>;
39
+ /** A name in {@link NAMED_IRRATIONALS}. */
40
+ export type IrrationalName = keyof typeof NAMED_IRRATIONALS;
41
+ /** Integer powers of named irrationals; a name with power 0 is absent. */
42
+ export type IrrationalPowers = Readonly<Partial<Record<IrrationalName, number>>>;
43
+ /** `num / den × Π name^power`, with `den > 0` and the fraction in lowest terms. */
44
+ export interface ExactScale {
45
+ readonly num: bigint;
46
+ readonly den: bigint;
47
+ /** Nonzero integer powers of named irrationals (`{ pi: 1 }` for `deg = pi/180`, `{}` when rational). */
48
+ readonly irrationals: IrrationalPowers;
49
+ }
50
+ /** The power of `name` in `s` (0 when absent). */
51
+ export declare function irrationalPower(s: ExactScale, name: IrrationalName): number;
52
+ /** Whether `s` is a plain rational (no irrational factor). */
53
+ export declare function isRationalScale(s: ExactScale): boolean;
54
+ /** The scale 1. */
55
+ export declare const UNIT_EXACT_SCALE: ExactScale;
56
+ /** A registered irrational itself, as a scale (`namedIrrationalScale('pi')` is π). */
57
+ export declare function namedIrrationalScale(name: IrrationalName): ExactScale;
58
+ /** π itself, as a scale. */
59
+ export declare const PI_EXACT_SCALE: ExactScale;
60
+ /** ln 2 itself, as a scale. */
61
+ export declare const LN2_EXACT_SCALE: ExactScale;
62
+ /** The exact value of a decimal literal, or null when `text` is not one. */
63
+ export declare function decimalExactScale(text: string): ExactScale | null;
64
+ /** The exact decimal a finite JavaScript number prints as (its shortest round-trip form). */
65
+ export declare function exactScaleOf(x: number): ExactScale;
66
+ /**
67
+ * The exact binary value of a finite double (`0.1` is 3602879701896397 / 2^55).
68
+ * This is the value a computed double holds, where {@link exactScaleOf} reads
69
+ * the decimal a typed number was meant as.
70
+ */
71
+ export declare function binaryExactScale(x: number): ExactScale;
72
+ /** `num / den`, exactly. */
73
+ export declare function ratioExactScale(num: number | bigint, den?: number | bigint): ExactScale;
74
+ /** `a × b × …`. */
75
+ export declare function multiplyExactScales(...factors: readonly ExactScale[]): ExactScale;
76
+ /** `a / b`. */
77
+ export declare function divideExactScales(a: ExactScale, b: ExactScale): ExactScale;
78
+ /** `a ^ n` for an integer `n`. A fractional power has no exact form and throws. */
79
+ export declare function powerExactScale(a: ExactScale, n: number): ExactScale;
80
+ /** Whether two exact scales are the same number. */
81
+ export declare function exactScalesEqual(a: ExactScale, b: ExactScale): boolean;
82
+ /**
83
+ * `a + b`, when both carry the same irrational powers; null otherwise (the
84
+ * registered irrationals are taken as algebraically independent over Q).
85
+ */
86
+ export declare function addExactScales(a: ExactScale, b: ExactScale): ExactScale | null;
87
+ /**
88
+ * The most results {@link exactScaleToNumber} keeps. Unit readings reach it as exact scales,
89
+ * so one entry per distinct reading would grow without bound.
90
+ */
91
+ export declare const EXACT_SCALE_NUMBER_CACHE_LIMIT = 4096;
92
+ /**
93
+ * The scale as a double, rounded once, remembered for this scale object only. For one-off
94
+ * scales (a unit's exact reading) this skips the string-keyed memo of {@link exactScaleToNumber},
95
+ * whose key would cost as much as the rounding.
96
+ */
97
+ export declare function roundExactScale(s: ExactScale): number;
98
+ /** Drop the {@link exactScaleToNumber} memo table (tests). */
99
+ export declare function clearExactScaleNumberCache(): void;
100
+ /** How many exact scales have a cached double (tests / diagnostics). */
101
+ export declare function exactScaleNumberCacheSize(): number;
102
+ /** Whether the scale has a cached double. Reads the memo without changing its order (tests). */
103
+ export declare function exactScaleNumberCacheHas(s: ExactScale): boolean;
104
+ /**
105
+ * The scale as a double, rounded once. Repeated calls reuse a memoized result. The memo keeps at
106
+ * most {@link EXACT_SCALE_NUMBER_CACHE_LIMIT} results; when it is full, the entry that was used
107
+ * longest ago leaves first (a `Map` iterates in insertion order, and a hit re-inserts its key).
108
+ */
109
+ export declare function exactScaleToNumber(s: ExactScale): number;
110
+ /** The scale as text: `num/den`, then `*name` / `*name^k` for each irrational factor. */
111
+ export declare function formatExactScale(s: ExactScale): string;
112
+ /**
113
+ * The exact value of a scale expression (`'lbf/inch^2'`, `'648000*astronomical_unit/pi'`,
114
+ * `'101325/760'`, `'ln2'`, `'1/(2 * pi)'`). `resolve` gives a name its scale and returns
115
+ * undefined for a name it does not know, which throws here. A name in
116
+ * {@link NAMED_IRRATIONALS} always means that constant.
117
+ */
118
+ export declare function readScaleExpression(text: string, resolve?: (name: string) => ExactScale | undefined): ExactScale;
119
+ //# sourceMappingURL=exact-scale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exact-scale.d.ts","sourceRoot":"","sources":["../../../src/types/unit/exact-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB;i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'./Unit.js';
3
3
  export { unitDependencies } from './dependencies.js';
4
4
  export type * from './unit-types.js';
5
+ export { UNIT_EXACT_SCALE, PI_EXACT_SCALE, LN2_EXACT_SCALE, NAMED_IRRATIONALS, namedIrrationalScale, irrationalPower, isRationalScale, decimalExactScale, exactScaleOf, binaryExactScale, ratioExactScale, multiplyExactScales, divideExactScales, powerExactScale, addExactScales, exactScalesEqual, exactScaleToNumber, clearExactScaleNumberCache, exactScaleNumberCacheSize, formatExactScale, readScaleExpression, } from './exact-scale.js';
6
+ export type { ExactScale, IrrationalName, IrrationalPowers } from './exact-scale.js';
7
+ export { NAMED_SCALES, UNIT_ROWS, UNIT_ROW_ALIASES, namedExactScale, readUnitScale, getUnitRow, unitRowExactScale, unitRowValue, unitRowExactOffset, UNIT_PREFIX_SETS, unitPrefixExactScale, getUnitPrefix, } from './unit-table.js';
8
+ export type { UnitRow, UnitBaseKey, UnitPrefixSetKey, UnitPrefix } from './unit-table.js';
5
9
  /** The core `Unit` class, pre-wired to core's numeric primitives. */
6
10
  export declare const Unit: UnitConstructor;
7
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/unit/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,mBAAmB,iBAAiB,CAAC;AAErC,qEAAqE;AACrE,eAAO,MAAM,IAAI,EAAE,eAEC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/unit/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAg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