@ac-kit/math-numbers 0.1.1 → 0.2.1

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +1 -1
  3. package/dist/fixed-int-big/_validate-bit-width.d.ts +10 -0
  4. package/dist/fixed-int-big/_validate-bit-width.d.ts.map +1 -0
  5. package/dist/fixed-int-big/_validate-bit-width.js +14 -0
  6. package/dist/fixed-int-big/_validate-bit-width.js.map +1 -0
  7. package/dist/fixed-int-big/_validate-shift-count.d.ts +10 -0
  8. package/dist/fixed-int-big/_validate-shift-count.d.ts.map +1 -0
  9. package/dist/fixed-int-big/_validate-shift-count.js +14 -0
  10. package/dist/fixed-int-big/_validate-shift-count.js.map +1 -0
  11. package/dist/fixed-int-big/fixed-sint-big-abs.d.ts +16 -0
  12. package/dist/fixed-int-big/fixed-sint-big-abs.d.ts.map +1 -0
  13. package/dist/fixed-int-big/fixed-sint-big-abs.js +19 -0
  14. package/dist/fixed-int-big/fixed-sint-big-abs.js.map +1 -0
  15. package/dist/fixed-int-big/fixed-sint-big-add.d.ts +14 -0
  16. package/dist/fixed-int-big/fixed-sint-big-add.d.ts.map +1 -0
  17. package/dist/fixed-int-big/fixed-sint-big-add.js +16 -0
  18. package/dist/fixed-int-big/fixed-sint-big-add.js.map +1 -0
  19. package/dist/fixed-int-big/fixed-sint-big-div.d.ts +24 -0
  20. package/dist/fixed-int-big/fixed-sint-big-div.d.ts.map +1 -0
  21. package/dist/fixed-int-big/fixed-sint-big-div.js +27 -0
  22. package/dist/fixed-int-big/fixed-sint-big-div.js.map +1 -0
  23. package/dist/fixed-int-big/fixed-sint-big-from.d.ts +27 -0
  24. package/dist/fixed-int-big/fixed-sint-big-from.d.ts.map +1 -0
  25. package/dist/fixed-int-big/fixed-sint-big-from.js +46 -0
  26. package/dist/fixed-int-big/fixed-sint-big-from.js.map +1 -0
  27. package/dist/fixed-int-big/fixed-sint-big-is-in-range.d.ts +10 -0
  28. package/dist/fixed-int-big/fixed-sint-big-is-in-range.d.ts.map +1 -0
  29. package/dist/fixed-int-big/fixed-sint-big-is-in-range.js +16 -0
  30. package/dist/fixed-int-big/fixed-sint-big-is-in-range.js.map +1 -0
  31. package/dist/fixed-int-big/fixed-sint-big-max.d.ts +13 -0
  32. package/dist/fixed-int-big/fixed-sint-big-max.d.ts.map +1 -0
  33. package/dist/fixed-int-big/fixed-sint-big-max.js +19 -0
  34. package/dist/fixed-int-big/fixed-sint-big-max.js.map +1 -0
  35. package/dist/fixed-int-big/fixed-sint-big-min.d.ts +14 -0
  36. package/dist/fixed-int-big/fixed-sint-big-min.d.ts.map +1 -0
  37. package/dist/fixed-int-big/fixed-sint-big-min.js +19 -0
  38. package/dist/fixed-int-big/fixed-sint-big-min.js.map +1 -0
  39. package/dist/fixed-int-big/fixed-sint-big-mul.d.ts +19 -0
  40. package/dist/fixed-int-big/fixed-sint-big-mul.d.ts.map +1 -0
  41. package/dist/fixed-int-big/fixed-sint-big-mul.js +21 -0
  42. package/dist/fixed-int-big/fixed-sint-big-mul.js.map +1 -0
  43. package/dist/fixed-int-big/fixed-sint-big-neg.d.ts +17 -0
  44. package/dist/fixed-int-big/fixed-sint-big-neg.d.ts.map +1 -0
  45. package/dist/fixed-int-big/fixed-sint-big-neg.js +19 -0
  46. package/dist/fixed-int-big/fixed-sint-big-neg.js.map +1 -0
  47. package/dist/fixed-int-big/fixed-sint-big-pop-count.d.ts +15 -0
  48. package/dist/fixed-int-big/fixed-sint-big-pop-count.d.ts.map +1 -0
  49. package/dist/fixed-int-big/fixed-sint-big-pop-count.js +19 -0
  50. package/dist/fixed-int-big/fixed-sint-big-pop-count.js.map +1 -0
  51. package/dist/fixed-int-big/fixed-sint-big-rem.d.ts +19 -0
  52. package/dist/fixed-int-big/fixed-sint-big-rem.d.ts.map +1 -0
  53. package/dist/fixed-int-big/fixed-sint-big-rem.js +24 -0
  54. package/dist/fixed-int-big/fixed-sint-big-rem.js.map +1 -0
  55. package/dist/fixed-int-big/fixed-sint-big-shift-left.d.ts +20 -0
  56. package/dist/fixed-int-big/fixed-sint-big-shift-left.d.ts.map +1 -0
  57. package/dist/fixed-int-big/fixed-sint-big-shift-left.js +24 -0
  58. package/dist/fixed-int-big/fixed-sint-big-shift-left.js.map +1 -0
  59. package/dist/fixed-int-big/fixed-sint-big-shift-right.d.ts +16 -0
  60. package/dist/fixed-int-big/fixed-sint-big-shift-right.d.ts.map +1 -0
  61. package/dist/fixed-int-big/fixed-sint-big-shift-right.js +20 -0
  62. package/dist/fixed-int-big/fixed-sint-big-shift-right.js.map +1 -0
  63. package/dist/fixed-int-big/fixed-sint-big-sub.d.ts +15 -0
  64. package/dist/fixed-int-big/fixed-sint-big-sub.d.ts.map +1 -0
  65. package/dist/fixed-int-big/fixed-sint-big-sub.js +17 -0
  66. package/dist/fixed-int-big/fixed-sint-big-sub.js.map +1 -0
  67. package/dist/fixed-int-big/fixed-sint-big-to-unsigned.d.ts +18 -0
  68. package/dist/fixed-int-big/fixed-sint-big-to-unsigned.d.ts.map +1 -0
  69. package/dist/fixed-int-big/fixed-sint-big-to-unsigned.js +22 -0
  70. package/dist/fixed-int-big/fixed-sint-big-to-unsigned.js.map +1 -0
  71. package/dist/fixed-int-big/fixed-sint-big-unsigned-shift-right.d.ts +17 -0
  72. package/dist/fixed-int-big/fixed-sint-big-unsigned-shift-right.d.ts.map +1 -0
  73. package/dist/fixed-int-big/fixed-sint-big-unsigned-shift-right.js +24 -0
  74. package/dist/fixed-int-big/fixed-sint-big-unsigned-shift-right.js.map +1 -0
  75. package/dist/fixed-int-big/fixed-uint-big-add.d.ts +14 -0
  76. package/dist/fixed-int-big/fixed-uint-big-add.d.ts.map +1 -0
  77. package/dist/fixed-int-big/fixed-uint-big-add.js +16 -0
  78. package/dist/fixed-int-big/fixed-uint-big-add.js.map +1 -0
  79. package/dist/fixed-int-big/fixed-uint-big-from.d.ts +20 -0
  80. package/dist/fixed-int-big/fixed-uint-big-from.d.ts.map +1 -0
  81. package/dist/fixed-int-big/fixed-uint-big-from.js +37 -0
  82. package/dist/fixed-int-big/fixed-uint-big-from.js.map +1 -0
  83. package/dist/fixed-int-big/fixed-uint-big-is-in-range.d.ts +10 -0
  84. package/dist/fixed-int-big/fixed-uint-big-is-in-range.d.ts.map +1 -0
  85. package/dist/fixed-int-big/fixed-uint-big-is-in-range.js +15 -0
  86. package/dist/fixed-int-big/fixed-uint-big-is-in-range.js.map +1 -0
  87. package/dist/fixed-int-big/fixed-uint-big-max.d.ts +17 -0
  88. package/dist/fixed-int-big/fixed-uint-big-max.d.ts.map +1 -0
  89. package/dist/fixed-int-big/fixed-uint-big-max.js +19 -0
  90. package/dist/fixed-int-big/fixed-uint-big-max.js.map +1 -0
  91. package/dist/fixed-int-big/fixed-uint-big-mul.d.ts +18 -0
  92. package/dist/fixed-int-big/fixed-uint-big-mul.d.ts.map +1 -0
  93. package/dist/fixed-int-big/fixed-uint-big-mul.js +20 -0
  94. package/dist/fixed-int-big/fixed-uint-big-mul.js.map +1 -0
  95. package/dist/fixed-int-big/fixed-uint-big-neg.d.ts +17 -0
  96. package/dist/fixed-int-big/fixed-uint-big-neg.d.ts.map +1 -0
  97. package/dist/fixed-int-big/fixed-uint-big-neg.js +19 -0
  98. package/dist/fixed-int-big/fixed-uint-big-neg.js.map +1 -0
  99. package/dist/fixed-int-big/fixed-uint-big-not.d.ts +16 -0
  100. package/dist/fixed-int-big/fixed-uint-big-not.d.ts.map +1 -0
  101. package/dist/fixed-int-big/fixed-uint-big-not.js +20 -0
  102. package/dist/fixed-int-big/fixed-uint-big-not.js.map +1 -0
  103. package/dist/fixed-int-big/fixed-uint-big-shift-left.d.ts +19 -0
  104. package/dist/fixed-int-big/fixed-uint-big-shift-left.d.ts.map +1 -0
  105. package/dist/fixed-int-big/fixed-uint-big-shift-left.js +23 -0
  106. package/dist/fixed-int-big/fixed-uint-big-shift-left.js.map +1 -0
  107. package/dist/fixed-int-big/fixed-uint-big-shift-right.d.ts +15 -0
  108. package/dist/fixed-int-big/fixed-uint-big-shift-right.d.ts.map +1 -0
  109. package/dist/fixed-int-big/fixed-uint-big-shift-right.js +19 -0
  110. package/dist/fixed-int-big/fixed-uint-big-shift-right.js.map +1 -0
  111. package/dist/fixed-int-big/fixed-uint-big-sub.d.ts +19 -0
  112. package/dist/fixed-int-big/fixed-uint-big-sub.d.ts.map +1 -0
  113. package/dist/fixed-int-big/fixed-uint-big-sub.js +21 -0
  114. package/dist/fixed-int-big/fixed-uint-big-sub.js.map +1 -0
  115. package/dist/fixed-int-big/fixed-uint-big-to-signed.d.ts +13 -0
  116. package/dist/fixed-int-big/fixed-uint-big-to-signed.d.ts.map +1 -0
  117. package/dist/fixed-int-big/fixed-uint-big-to-signed.js +17 -0
  118. package/dist/fixed-int-big/fixed-uint-big-to-signed.js.map +1 -0
  119. package/dist/ieee754/binary/kernels/wasm/_wasm-bytes.generated.d.ts +1 -1
  120. package/dist/ieee754/binary/kernels/wasm/_wasm-bytes.generated.js +1 -1
  121. package/dist/ieee754/binary/kernels/wasm/_wasm-bytes.generated.js.map +1 -1
  122. package/dist/index.d.ts +27 -0
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +27 -0
  125. package/dist/index.js.map +1 -1
  126. package/package.json +10 -10
@@ -0,0 +1,19 @@
1
+ import { bigIntPopCount } from "@ac-kit/core";
2
+ import { fixedSIntBigToUnsigned } from "./fixed-sint-big-to-unsigned.js";
3
+ /**
4
+ * Set bits in the `bitWidth`-bit two's-complement pattern of `value`: `-1n` at
5
+ * 8 bits answers `8`.
6
+ *
7
+ * Distinct from `@ac-kit/core`'s `bigIntPopCount`, which counts the magnitude
8
+ * and would answer `1` for the same input. Both are right for what they are
9
+ * asked — an unbounded `bigint` has no finite two's-complement pattern to count
10
+ * — and `bitWidth` is exactly what supplies the missing one.
11
+ *
12
+ * @param value - The value to count.
13
+ * @param bitWidth - Width of the integer, in bits.
14
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
15
+ */
16
+ export function fixedSIntBigPopCount(value, bitWidth) {
17
+ return bigIntPopCount(fixedSIntBigToUnsigned(value, bitWidth));
18
+ }
19
+ //# sourceMappingURL=fixed-sint-big-pop-count.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-pop-count.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-pop-count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,QAAgB;IACnE,OAAO,cAAc,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Remainder of two `bitWidth`-bit two's-complement integers, truncated toward
3
+ * zero — the sign follows the dividend, as C's `%` and `bigint`'s own do.
4
+ *
5
+ * Takes no overflow mode because it cannot overflow: the magnitude of a
6
+ * remainder is strictly below the divisor's, so it always fits a type the
7
+ * divisor already fits. It takes no `bitWidth` for the same reason — nothing
8
+ * here depends on one. That also settles the pair C leaves undefined: the
9
+ * minimum modulo `-1` is `0n`, not a trap.
10
+ *
11
+ * There is no unsigned counterpart: with two non-negative operands `%` has no
12
+ * convention left to pin and cannot overflow either.
13
+ *
14
+ * @param left - Dividend.
15
+ * @param right - Divisor.
16
+ * @throws {RangeError} When `right` is zero.
17
+ */
18
+ export declare function fixedSIntBigRem(left: bigint, right: bigint): bigint;
19
+ //# sourceMappingURL=fixed-sint-big-rem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-rem.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-rem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMnE"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Remainder of two `bitWidth`-bit two's-complement integers, truncated toward
3
+ * zero — the sign follows the dividend, as C's `%` and `bigint`'s own do.
4
+ *
5
+ * Takes no overflow mode because it cannot overflow: the magnitude of a
6
+ * remainder is strictly below the divisor's, so it always fits a type the
7
+ * divisor already fits. It takes no `bitWidth` for the same reason — nothing
8
+ * here depends on one. That also settles the pair C leaves undefined: the
9
+ * minimum modulo `-1` is `0n`, not a trap.
10
+ *
11
+ * There is no unsigned counterpart: with two non-negative operands `%` has no
12
+ * convention left to pin and cannot overflow either.
13
+ *
14
+ * @param left - Dividend.
15
+ * @param right - Divisor.
16
+ * @throws {RangeError} When `right` is zero.
17
+ */
18
+ export function fixedSIntBigRem(left, right) {
19
+ if (right === 0n) {
20
+ throw new RangeError("Division by zero");
21
+ }
22
+ return left % right;
23
+ }
24
+ //# sourceMappingURL=fixed-sint-big-rem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-rem.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-rem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IAC1D,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,IAAI,GAAG,KAAK,CAAC;AACrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Left shift of a `bitWidth`-bit two's-complement integer, under `mode`.
4
+ *
5
+ * The shift happens at full `bigint` width and the policy applies to the exact
6
+ * result, so a count at or beyond `bitWidth` is well defined rather than
7
+ * undefined as it is in C: under `wrap` every bit has left the window and the
8
+ * answer is `0n`.
9
+ *
10
+ * @param value - The value to shift.
11
+ * @param count - Bit positions to shift by; non-negative.
12
+ * @param bitWidth - Width of the integer, in bits.
13
+ * @param mode - Overflow policy. Defaults to
14
+ * `numericConfig.defaultOverflowMode`.
15
+ * @throws {RangeError} When `count` is negative or not a safe integer, or
16
+ * `bitWidth` is not a non-negative safe integer.
17
+ * @throws {OverflowError} When the result does not fit and `mode` is `abort`.
18
+ */
19
+ export declare function fixedSIntBigShiftLeft(value: bigint, count: number, bitWidth: number, mode?: OverflowMode): bigint;
20
+ //# sourceMappingURL=fixed-sint-big-shift-left.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-shift-left.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-shift-left.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GACjB,MAAM,CAIR"}
@@ -0,0 +1,24 @@
1
+ import { validateShiftCount } from "./_validate-shift-count.js";
2
+ import { fixedSIntBigFrom } from "./fixed-sint-big-from.js";
3
+ /**
4
+ * Left shift of a `bitWidth`-bit two's-complement integer, under `mode`.
5
+ *
6
+ * The shift happens at full `bigint` width and the policy applies to the exact
7
+ * result, so a count at or beyond `bitWidth` is well defined rather than
8
+ * undefined as it is in C: under `wrap` every bit has left the window and the
9
+ * answer is `0n`.
10
+ *
11
+ * @param value - The value to shift.
12
+ * @param count - Bit positions to shift by; non-negative.
13
+ * @param bitWidth - Width of the integer, in bits.
14
+ * @param mode - Overflow policy. Defaults to
15
+ * `numericConfig.defaultOverflowMode`.
16
+ * @throws {RangeError} When `count` is negative or not a safe integer, or
17
+ * `bitWidth` is not a non-negative safe integer.
18
+ * @throws {OverflowError} When the result does not fit and `mode` is `abort`.
19
+ */
20
+ export function fixedSIntBigShiftLeft(value, count, bitWidth, mode) {
21
+ validateShiftCount(count);
22
+ return fixedSIntBigFrom(value << BigInt(count), bitWidth, mode);
23
+ }
24
+ //# sourceMappingURL=fixed-sint-big-shift-left.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-shift-left.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-shift-left.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,qBAAqB,CACpC,KAAa,EACb,KAAa,EACb,QAAgB,EAChB,IAAmB;IAEnB,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,gBAAgB,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Arithmetic right shift of a `bitWidth`-bit two's-complement integer: the sign
3
+ * bit fills from the left, so a negative value shifts toward `-1n` and a
4
+ * non-negative one toward `0n`.
5
+ *
6
+ * Takes no overflow mode and no `bitWidth` because neither applies: shifting
7
+ * right only ever brings a value closer to zero or to `-1n`, both of which fit
8
+ * any width the input fit. A count at or beyond the width is well defined and
9
+ * saturating rather than undefined as it is in C.
10
+ *
11
+ * @param value - The value to shift.
12
+ * @param count - Bit positions to shift by; non-negative.
13
+ * @throws {RangeError} When `count` is negative or not a safe integer.
14
+ */
15
+ export declare function fixedSIntBigShiftRight(value: bigint, count: number): bigint;
16
+ //# sourceMappingURL=fixed-sint-big-shift-right.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-shift-right.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-shift-right.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E"}
@@ -0,0 +1,20 @@
1
+ import { validateShiftCount } from "./_validate-shift-count.js";
2
+ /**
3
+ * Arithmetic right shift of a `bitWidth`-bit two's-complement integer: the sign
4
+ * bit fills from the left, so a negative value shifts toward `-1n` and a
5
+ * non-negative one toward `0n`.
6
+ *
7
+ * Takes no overflow mode and no `bitWidth` because neither applies: shifting
8
+ * right only ever brings a value closer to zero or to `-1n`, both of which fit
9
+ * any width the input fit. A count at or beyond the width is well defined and
10
+ * saturating rather than undefined as it is in C.
11
+ *
12
+ * @param value - The value to shift.
13
+ * @param count - Bit positions to shift by; non-negative.
14
+ * @throws {RangeError} When `count` is negative or not a safe integer.
15
+ */
16
+ export function fixedSIntBigShiftRight(value, count) {
17
+ validateShiftCount(count);
18
+ return value >> BigInt(count);
19
+ }
20
+ //# sourceMappingURL=fixed-sint-big-shift-right.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-shift-right.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-shift-right.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,KAAa;IAClE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Difference of two `bitWidth`-bit two's-complement integers, under `mode`.
4
+ *
5
+ * @param left - Left operand.
6
+ * @param right - Right operand.
7
+ * @param bitWidth - Width of the integer, in bits.
8
+ * @param mode - Overflow policy. Defaults to
9
+ * `numericConfig.defaultOverflowMode`.
10
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
11
+ * @throws {OverflowError} When the difference does not fit and `mode` is
12
+ * `abort`.
13
+ */
14
+ export declare function fixedSIntBigSub(left: bigint, right: bigint, bitWidth: number, mode?: OverflowMode): bigint;
15
+ //# sourceMappingURL=fixed-sint-big-sub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-sub.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-sub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GACjB,MAAM,CAER"}
@@ -0,0 +1,17 @@
1
+ import { fixedSIntBigFrom } from "./fixed-sint-big-from.js";
2
+ /**
3
+ * Difference of two `bitWidth`-bit two's-complement integers, under `mode`.
4
+ *
5
+ * @param left - Left operand.
6
+ * @param right - Right operand.
7
+ * @param bitWidth - Width of the integer, in bits.
8
+ * @param mode - Overflow policy. Defaults to
9
+ * `numericConfig.defaultOverflowMode`.
10
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
11
+ * @throws {OverflowError} When the difference does not fit and `mode` is
12
+ * `abort`.
13
+ */
14
+ export function fixedSIntBigSub(left, right, bitWidth, mode) {
15
+ return fixedSIntBigFrom(left - right, bitWidth, mode);
16
+ }
17
+ //# sourceMappingURL=fixed-sint-big-sub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-sub.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-sub.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,KAAa,EACb,QAAgB,EAChB,IAAmB;IAEnB,OAAO,gBAAgB,CAAC,IAAI,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The same bit pattern read as an unsigned integer: `-1n` at 8 bits becomes
3
+ * `255n`, and a non-negative value is returned unchanged.
4
+ *
5
+ * A reinterpretation, not a conversion — the bits do not move. This is what the
6
+ * operations that are defined on the pattern rather than on the number need: an
7
+ * unsigned right shift has to fill from a real top bit, and a population count
8
+ * has to have a finite number of bits to count.
9
+ *
10
+ * A `value` outside the signed range is truncated into it on the way, since
11
+ * truncation is that wrap.
12
+ *
13
+ * @param value - A `bitWidth`-bit two's-complement value.
14
+ * @param bitWidth - Width of the integer, in bits.
15
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
16
+ */
17
+ export declare function fixedSIntBigToUnsigned(value: bigint, bitWidth: number): bigint;
18
+ //# sourceMappingURL=fixed-sint-big-to-unsigned.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-to-unsigned.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-to-unsigned.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACd,MAAM,CAIR"}
@@ -0,0 +1,22 @@
1
+ import { validateBitWidth } from "./_validate-bit-width.js";
2
+ /**
3
+ * The same bit pattern read as an unsigned integer: `-1n` at 8 bits becomes
4
+ * `255n`, and a non-negative value is returned unchanged.
5
+ *
6
+ * A reinterpretation, not a conversion — the bits do not move. This is what the
7
+ * operations that are defined on the pattern rather than on the number need: an
8
+ * unsigned right shift has to fill from a real top bit, and a population count
9
+ * has to have a finite number of bits to count.
10
+ *
11
+ * A `value` outside the signed range is truncated into it on the way, since
12
+ * truncation is that wrap.
13
+ *
14
+ * @param value - A `bitWidth`-bit two's-complement value.
15
+ * @param bitWidth - Width of the integer, in bits.
16
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
17
+ */
18
+ export function fixedSIntBigToUnsigned(value, bitWidth) {
19
+ validateBitWidth(bitWidth);
20
+ return BigInt.asUintN(bitWidth, value);
21
+ }
22
+ //# sourceMappingURL=fixed-sint-big-to-unsigned.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-to-unsigned.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-to-unsigned.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CACrC,KAAa,EACb,QAAgB;IAEhB,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE3B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Logical right shift of a `bitWidth`-bit two's-complement integer: zeros fill
3
+ * from the left, so `-1n` at 8 bits shifted by one is `127n`, not `-1n`.
4
+ *
5
+ * This is the one right shift that needs `bitWidth`. "Fill with zeros from the
6
+ * left" presupposes a leftmost bit, and a `bigint` has none — a negative one
7
+ * behaves as an infinite run of sign bits. The width is what makes the top bit
8
+ * exist, so the value is read as a pattern, shifted, and read back.
9
+ *
10
+ * @param value - The value to shift.
11
+ * @param count - Bit positions to shift by; non-negative.
12
+ * @param bitWidth - Width of the integer, in bits.
13
+ * @throws {RangeError} When `count` is negative or not a safe integer, or
14
+ * `bitWidth` is not a non-negative safe integer.
15
+ */
16
+ export declare function fixedSIntBigUnsignedShiftRight(value: bigint, count: number, bitWidth: number): bigint;
17
+ //# sourceMappingURL=fixed-sint-big-unsigned-shift-right.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-unsigned-shift-right.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-unsigned-shift-right.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC7C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACd,MAAM,CAMR"}
@@ -0,0 +1,24 @@
1
+ import { validateShiftCount } from "./_validate-shift-count.js";
2
+ import { fixedSIntBigToUnsigned } from "./fixed-sint-big-to-unsigned.js";
3
+ import { fixedUIntBigToSigned } from "./fixed-uint-big-to-signed.js";
4
+ /**
5
+ * Logical right shift of a `bitWidth`-bit two's-complement integer: zeros fill
6
+ * from the left, so `-1n` at 8 bits shifted by one is `127n`, not `-1n`.
7
+ *
8
+ * This is the one right shift that needs `bitWidth`. "Fill with zeros from the
9
+ * left" presupposes a leftmost bit, and a `bigint` has none — a negative one
10
+ * behaves as an infinite run of sign bits. The width is what makes the top bit
11
+ * exist, so the value is read as a pattern, shifted, and read back.
12
+ *
13
+ * @param value - The value to shift.
14
+ * @param count - Bit positions to shift by; non-negative.
15
+ * @param bitWidth - Width of the integer, in bits.
16
+ * @throws {RangeError} When `count` is negative or not a safe integer, or
17
+ * `bitWidth` is not a non-negative safe integer.
18
+ */
19
+ export function fixedSIntBigUnsignedShiftRight(value, count, bitWidth) {
20
+ validateShiftCount(count);
21
+ const pattern = fixedSIntBigToUnsigned(value, bitWidth) >> BigInt(count);
22
+ return fixedUIntBigToSigned(pattern, bitWidth);
23
+ }
24
+ //# sourceMappingURL=fixed-sint-big-unsigned-shift-right.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-sint-big-unsigned-shift-right.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-sint-big-unsigned-shift-right.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,8BAA8B,CAC7C,KAAa,EACb,KAAa,EACb,QAAgB;IAEhB,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1B,MAAM,OAAO,GAAG,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAEzE,OAAO,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Sum of two `bitWidth`-bit unsigned integers, under `mode`.
4
+ *
5
+ * @param left - Left operand.
6
+ * @param right - Right operand.
7
+ * @param bitWidth - Width of the integer, in bits.
8
+ * @param mode - Overflow policy. Defaults to
9
+ * `numericConfig.defaultOverflowMode`.
10
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
11
+ * @throws {OverflowError} When the sum does not fit and `mode` is `abort`.
12
+ */
13
+ export declare function fixedUIntBigAdd(left: bigint, right: bigint, bitWidth: number, mode?: OverflowMode): bigint;
14
+ //# sourceMappingURL=fixed-uint-big-add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-add.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GACjB,MAAM,CAER"}
@@ -0,0 +1,16 @@
1
+ import { fixedUIntBigFrom } from "./fixed-uint-big-from.js";
2
+ /**
3
+ * Sum of two `bitWidth`-bit unsigned integers, under `mode`.
4
+ *
5
+ * @param left - Left operand.
6
+ * @param right - Right operand.
7
+ * @param bitWidth - Width of the integer, in bits.
8
+ * @param mode - Overflow policy. Defaults to
9
+ * `numericConfig.defaultOverflowMode`.
10
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
11
+ * @throws {OverflowError} When the sum does not fit and `mode` is `abort`.
12
+ */
13
+ export function fixedUIntBigAdd(left, right, bitWidth, mode) {
14
+ return fixedUIntBigFrom(left + right, bitWidth, mode);
15
+ }
16
+ //# sourceMappingURL=fixed-uint-big-add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-add.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,KAAa,EACb,QAAgB,EAChB,IAAmB;IAEnB,OAAO,gBAAgB,CAAC,IAAI,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Brings an arbitrary `bigint` into a `bitWidth`-bit unsigned integer under
4
+ * `mode`.
5
+ *
6
+ * Every unsigned operation in this directory ends here, for the same reason
7
+ * {@link fixedSIntBigFrom} collects the signed ones: the exact `bigint` result
8
+ * cannot overflow, so the policy applies once, at the end.
9
+ *
10
+ * @param value - The exact value to fit.
11
+ * @param bitWidth - Width of the integer, in bits.
12
+ * @param mode - Overflow policy. Defaults to
13
+ * `numericConfig.defaultOverflowMode`.
14
+ * @returns `value` itself when it already fits, and otherwise the wrapped,
15
+ * clamped or (for `abort`) never-returned result.
16
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
17
+ * @throws {OverflowError} When `value` does not fit and `mode` is `abort`.
18
+ */
19
+ export declare function fixedUIntBigFrom(value: bigint, bitWidth: number, mode?: OverflowMode): bigint;
20
+ //# sourceMappingURL=fixed-uint-big-from.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-from.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-from.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,qBAAqB,CAAC;AAIvE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,YAAgD,GACpD,MAAM,CAmBR"}
@@ -0,0 +1,37 @@
1
+ import { numericConfig } from "../globals.js";
2
+ import { OverflowError } from "../overflow-mode.js";
3
+ import { validateBitWidth } from "./_validate-bit-width.js";
4
+ import { fixedUIntBigMax } from "./fixed-uint-big-max.js";
5
+ /**
6
+ * Brings an arbitrary `bigint` into a `bitWidth`-bit unsigned integer under
7
+ * `mode`.
8
+ *
9
+ * Every unsigned operation in this directory ends here, for the same reason
10
+ * {@link fixedSIntBigFrom} collects the signed ones: the exact `bigint` result
11
+ * cannot overflow, so the policy applies once, at the end.
12
+ *
13
+ * @param value - The exact value to fit.
14
+ * @param bitWidth - Width of the integer, in bits.
15
+ * @param mode - Overflow policy. Defaults to
16
+ * `numericConfig.defaultOverflowMode`.
17
+ * @returns `value` itself when it already fits, and otherwise the wrapped,
18
+ * clamped or (for `abort`) never-returned result.
19
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
20
+ * @throws {OverflowError} When `value` does not fit and `mode` is `abort`.
21
+ */
22
+ export function fixedUIntBigFrom(value, bitWidth, mode = numericConfig.defaultOverflowMode) {
23
+ validateBitWidth(bitWidth);
24
+ const max = fixedUIntBigMax(bitWidth);
25
+ if (value >= 0n && value <= max) {
26
+ return value;
27
+ }
28
+ switch (mode) {
29
+ case "wrap":
30
+ return BigInt.asUintN(bitWidth, value);
31
+ case "clamp":
32
+ return value < 0n ? 0n : max;
33
+ case "abort":
34
+ throw new OverflowError(`${value} does not fit a ${bitWidth}-bit unsigned integer`);
35
+ }
36
+ }
37
+ //# sourceMappingURL=fixed-uint-big-from.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-from.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAqB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAAa,EACb,QAAgB,EAChB,IAAI,GAAiB,aAAa,CAAC,mBAAmB;IAEtD,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE3B,MAAM,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEtC,IAAI,KAAK,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,MAAM;YACV,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxC,KAAK,OAAO;YACX,OAAO,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC9B,KAAK,OAAO;YACX,MAAM,IAAI,aAAa,CACtB,GAAG,KAAK,mBAAmB,QAAQ,uBAAuB,CAC1D,CAAC;IACJ,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether `value` already fits a `bitWidth`-bit unsigned integer, so no
3
+ * overflow policy has to be consulted.
4
+ *
5
+ * @param value - The value to test.
6
+ * @param bitWidth - Width of the integer, in bits.
7
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
8
+ */
9
+ export declare function fixedUIntBigIsInRange(value: bigint, bitWidth: number): boolean;
10
+ //# sourceMappingURL=fixed-uint-big-is-in-range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-is-in-range.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-is-in-range.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACd,OAAO,CAIT"}
@@ -0,0 +1,15 @@
1
+ import { validateBitWidth } from "./_validate-bit-width.js";
2
+ import { fixedUIntBigMax } from "./fixed-uint-big-max.js";
3
+ /**
4
+ * Whether `value` already fits a `bitWidth`-bit unsigned integer, so no
5
+ * overflow policy has to be consulted.
6
+ *
7
+ * @param value - The value to test.
8
+ * @param bitWidth - Width of the integer, in bits.
9
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
10
+ */
11
+ export function fixedUIntBigIsInRange(value, bitWidth) {
12
+ validateBitWidth(bitWidth);
13
+ return value >= 0n && value <= fixedUIntBigMax(bitWidth);
14
+ }
15
+ //# sourceMappingURL=fixed-uint-big-is-in-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-is-in-range.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-is-in-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACpC,KAAa,EACb,QAAgB;IAEhB,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE3B,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The largest value a `bitWidth`-bit unsigned integer holds: `2 ** bitWidth -
3
+ * 1`.
4
+ *
5
+ * There is no `fixedUIntBigMin` — it is `0n` at every width — and no separate
6
+ * mask constant: the only things that wanted one are `BigInt.asUintN` and
7
+ * `BigInt.asIntN`, which take the width directly.
8
+ *
9
+ * A width of zero answers `0n`, the single-valued range `BigInt.asUintN(0, x)`
10
+ * also lands on. Widths outside the non-negative integers are not part of the
11
+ * domain and are not rejected: unlike {@link fixedUIntBigFrom}, this admits no
12
+ * value and so has nothing to guard.
13
+ *
14
+ * @param bitWidth - Width of the integer, in bits.
15
+ */
16
+ export declare function fixedUIntBigMax(bitWidth: number): bigint;
17
+ //# sourceMappingURL=fixed-uint-big-max.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-max.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-max.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The largest value a `bitWidth`-bit unsigned integer holds: `2 ** bitWidth -
3
+ * 1`.
4
+ *
5
+ * There is no `fixedUIntBigMin` — it is `0n` at every width — and no separate
6
+ * mask constant: the only things that wanted one are `BigInt.asUintN` and
7
+ * `BigInt.asIntN`, which take the width directly.
8
+ *
9
+ * A width of zero answers `0n`, the single-valued range `BigInt.asUintN(0, x)`
10
+ * also lands on. Widths outside the non-negative integers are not part of the
11
+ * domain and are not rejected: unlike {@link fixedUIntBigFrom}, this admits no
12
+ * value and so has nothing to guard.
13
+ *
14
+ * @param bitWidth - Width of the integer, in bits.
15
+ */
16
+ export function fixedUIntBigMax(bitWidth) {
17
+ return (1n << BigInt(bitWidth)) - 1n;
18
+ }
19
+ //# sourceMappingURL=fixed-uint-big-max.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-max.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-max.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC/C,OAAO,CAAC,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Product of two `bitWidth`-bit unsigned integers, under `mode`.
4
+ *
5
+ * The exact product is computed at full `bigint` width before the policy
6
+ * applies, so `clamp` clamps against the true result rather than against one a
7
+ * hardware multiply has already truncated.
8
+ *
9
+ * @param left - Left operand.
10
+ * @param right - Right operand.
11
+ * @param bitWidth - Width of the integer, in bits.
12
+ * @param mode - Overflow policy. Defaults to
13
+ * `numericConfig.defaultOverflowMode`.
14
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
15
+ * @throws {OverflowError} When the product does not fit and `mode` is `abort`.
16
+ */
17
+ export declare function fixedUIntBigMul(left: bigint, right: bigint, bitWidth: number, mode?: OverflowMode): bigint;
18
+ //# sourceMappingURL=fixed-uint-big-mul.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-mul.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-mul.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GACjB,MAAM,CAER"}
@@ -0,0 +1,20 @@
1
+ import { fixedUIntBigFrom } from "./fixed-uint-big-from.js";
2
+ /**
3
+ * Product of two `bitWidth`-bit unsigned integers, under `mode`.
4
+ *
5
+ * The exact product is computed at full `bigint` width before the policy
6
+ * applies, so `clamp` clamps against the true result rather than against one a
7
+ * hardware multiply has already truncated.
8
+ *
9
+ * @param left - Left operand.
10
+ * @param right - Right operand.
11
+ * @param bitWidth - Width of the integer, in bits.
12
+ * @param mode - Overflow policy. Defaults to
13
+ * `numericConfig.defaultOverflowMode`.
14
+ * @throws {RangeError} When `bitWidth` is not a non-negative safe integer.
15
+ * @throws {OverflowError} When the product does not fit and `mode` is `abort`.
16
+ */
17
+ export function fixedUIntBigMul(left, right, bitWidth, mode) {
18
+ return fixedUIntBigFrom(left * right, bitWidth, mode);
19
+ }
20
+ //# sourceMappingURL=fixed-uint-big-mul.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-mul.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-mul.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,KAAa,EACb,QAAgB,EAChB,IAAmB;IAEnB,OAAO,gBAAgB,CAAC,IAAI,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { OverflowMode } from "../overflow-mode.js";
2
+ /**
3
+ * Negation of a `bitWidth`-bit unsigned integer, under `mode`.
4
+ *
5
+ * Every non-zero input overflows, since the unsigned range holds no negative
6
+ * value. That is not a degenerate case but the useful one: under `wrap` this is
7
+ * the two's-complement negation hardware performs, so `-x` is `2 ** bitWidth -
8
+ * x` and negating twice returns the original.
9
+ *
10
+ * @param value - The value to negate. @param bitWidth - Width of the integer,
11
+ * in bits. @param mode - Overflow policy. Defaults to
12
+ * `numericConfig.defaultOverflowMode`. @throws {RangeError} When `bitWidth`
13
+ * is not a non-negative safe integer. @throws {OverflowError} When `value` is
14
+ * non-zero and `mode` is `abort`.
15
+ */
16
+ export declare function fixedUIntBigNeg(value: bigint, bitWidth: number, mode?: OverflowMode): bigint;
17
+ //# sourceMappingURL=fixed-uint-big-neg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-neg.d.ts","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-neg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GACjB,MAAM,CAER"}
@@ -0,0 +1,19 @@
1
+ import { fixedUIntBigFrom } from "./fixed-uint-big-from.js";
2
+ /**
3
+ * Negation of a `bitWidth`-bit unsigned integer, under `mode`.
4
+ *
5
+ * Every non-zero input overflows, since the unsigned range holds no negative
6
+ * value. That is not a degenerate case but the useful one: under `wrap` this is
7
+ * the two's-complement negation hardware performs, so `-x` is `2 ** bitWidth -
8
+ * x` and negating twice returns the original.
9
+ *
10
+ * @param value - The value to negate. @param bitWidth - Width of the integer,
11
+ * in bits. @param mode - Overflow policy. Defaults to
12
+ * `numericConfig.defaultOverflowMode`. @throws {RangeError} When `bitWidth`
13
+ * is not a non-negative safe integer. @throws {OverflowError} When `value` is
14
+ * non-zero and `mode` is `abort`.
15
+ */
16
+ export function fixedUIntBigNeg(value, bitWidth, mode) {
17
+ return fixedUIntBigFrom(-value, bitWidth, mode);
18
+ }
19
+ //# sourceMappingURL=fixed-uint-big-neg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-uint-big-neg.js","sourceRoot":"","sources":["../../src/fixed-int-big/fixed-uint-big-neg.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAC9B,KAAa,EACb,QAAgB,EAChB,IAAmB;IAEnB,OAAO,gBAAgB,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC"}