@cortex-js/compute-engine 0.35.1 → 0.35.3

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 (177) hide show
  1. package/dist/compute-engine.esm.js +712 -80
  2. package/dist/compute-engine.min.esm.js +405 -52
  3. package/dist/compute-engine.min.umd.js +405 -52
  4. package/dist/compute-engine.umd.js +712 -80
  5. package/dist/math-json.esm.js +2 -2
  6. package/dist/math-json.min.esm.js +2 -2
  7. package/dist/math-json.min.umd.js +2 -2
  8. package/dist/math-json.umd.js +2 -2
  9. package/dist/types/common/ansi-codes.d.ts +1 -1
  10. package/dist/types/common/configuration-change.d.ts +1 -1
  11. package/dist/types/common/fuzzy-string-match.d.ts +1 -1
  12. package/dist/types/common/grapheme-splitter.d.ts +1 -1
  13. package/dist/types/common/interruptible.d.ts +1 -1
  14. package/dist/types/common/one-of.d.ts +1 -1
  15. package/dist/types/common/signals.d.ts +1 -1
  16. package/dist/types/common/type/ast-nodes.d.ts +1 -1
  17. package/dist/types/common/type/boxed-type.d.ts +1 -1
  18. package/dist/types/common/type/lexer.d.ts +1 -1
  19. package/dist/types/common/type/parse.d.ts +1 -1
  20. package/dist/types/common/type/parser.d.ts +1 -1
  21. package/dist/types/common/type/primitive.d.ts +1 -1
  22. package/dist/types/common/type/reduce.d.ts +1 -1
  23. package/dist/types/common/type/serialize.d.ts +1 -1
  24. package/dist/types/common/type/subtype.d.ts +1 -1
  25. package/dist/types/common/type/type-builder.d.ts +1 -1
  26. package/dist/types/common/type/types.d.ts +1 -1
  27. package/dist/types/common/type/utils.d.ts +1 -1
  28. package/dist/types/common/utils.d.ts +1 -1
  29. package/dist/types/compute-engine/assume.d.ts +1 -1
  30. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
  31. package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
  32. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
  33. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
  34. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
  35. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
  36. package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
  37. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
  38. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
  39. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
  40. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
  41. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
  42. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
  43. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
  44. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
  45. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
  46. package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
  47. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
  48. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
  49. package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
  50. package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
  51. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
  52. package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
  53. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
  54. package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
  55. package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
  56. package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
  57. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
  58. package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
  59. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
  60. package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
  61. package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
  62. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
  63. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
  64. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
  65. package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
  66. package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
  67. package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
  68. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
  69. package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
  70. package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
  71. package/dist/types/compute-engine/collection-utils.d.ts +1 -1
  72. package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
  73. package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
  74. package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
  75. package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +11 -1
  76. package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
  77. package/dist/types/compute-engine/compilation/types.d.ts +1 -1
  78. package/dist/types/compute-engine/cost-function.d.ts +1 -1
  79. package/dist/types/compute-engine/function-utils.d.ts +1 -1
  80. package/dist/types/compute-engine/global-types.d.ts +1 -1
  81. package/dist/types/compute-engine/index.d.ts +1 -1
  82. package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
  83. package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
  84. package/dist/types/compute-engine/interval/elementary.d.ts +24 -5
  85. package/dist/types/compute-engine/interval/index.d.ts +15 -5
  86. package/dist/types/compute-engine/interval/trigonometric.d.ts +55 -1
  87. package/dist/types/compute-engine/interval/types.d.ts +1 -1
  88. package/dist/types/compute-engine/interval/util.d.ts +1 -1
  89. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
  90. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
  91. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
  92. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
  93. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
  94. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
  95. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
  96. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
  97. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
  98. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
  99. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
  100. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
  101. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
  102. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
  103. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
  104. package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
  105. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
  106. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
  107. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
  108. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
  109. package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
  110. package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
  111. package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
  112. package/dist/types/compute-engine/library/calculus.d.ts +1 -1
  113. package/dist/types/compute-engine/library/collections.d.ts +1 -1
  114. package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
  115. package/dist/types/compute-engine/library/complex.d.ts +1 -1
  116. package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
  117. package/dist/types/compute-engine/library/core.d.ts +1 -1
  118. package/dist/types/compute-engine/library/invisible-operator.d.ts +1 -1
  119. package/dist/types/compute-engine/library/library.d.ts +1 -1
  120. package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
  121. package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
  122. package/dist/types/compute-engine/library/logic-utils.d.ts +1 -1
  123. package/dist/types/compute-engine/library/logic.d.ts +1 -1
  124. package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
  125. package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
  126. package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
  127. package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
  128. package/dist/types/compute-engine/library/sets.d.ts +1 -1
  129. package/dist/types/compute-engine/library/statistics.d.ts +1 -1
  130. package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
  131. package/dist/types/compute-engine/library/utils.d.ts +1 -1
  132. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
  133. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
  134. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
  135. package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
  136. package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
  137. package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
  138. package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
  139. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
  140. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
  141. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
  142. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
  143. package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
  144. package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
  145. package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
  146. package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
  147. package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
  148. package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
  149. package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
  150. package/dist/types/compute-engine/numerics/types.d.ts +1 -1
  151. package/dist/types/compute-engine/oeis.d.ts +1 -1
  152. package/dist/types/compute-engine/sequence.d.ts +1 -1
  153. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
  154. package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
  155. package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
  156. package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
  157. package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
  158. package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
  159. package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
  160. package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
  161. package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
  162. package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
  163. package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
  164. package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
  165. package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
  166. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
  167. package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
  168. package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
  169. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
  170. package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
  171. package/dist/types/compute-engine/types.d.ts +1 -1
  172. package/dist/types/compute-engine.d.ts +1 -1
  173. package/dist/types/math-json/symbols.d.ts +1 -1
  174. package/dist/types/math-json/types.d.ts +1 -1
  175. package/dist/types/math-json/utils.d.ts +1 -1
  176. package/dist/types/math-json.d.ts +2 -2
  177. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.1 */
1
+ /** Compute Engine 0.35.3 */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -5441,15 +5441,14 @@ function bigint(a) {
5441
5441
  }
5442
5442
  if (a instanceof Decimal) {
5443
5443
  if (!a.isInteger()) return null;
5444
- return bigint(a.toString());
5444
+ return BigInt(a.toFixed(0));
5445
5445
  }
5446
5446
  let s = a.toLowerCase();
5447
- const m = s.match(/([+-]?[0-9]*)(?:\.([0-9]+))?e([+-]?[0-9]+)$/);
5447
+ const m = s.match(/^([+-]?[0-9]+)e([+-]?[0-9]+)$/);
5448
5448
  if (m) {
5449
- const exp3 = parseInt(m[3]);
5450
- const pad = exp3 - (m[2] ? m[2].length : 0);
5451
- if (pad < 0) return null;
5452
- s = (m[1] ?? "") + (m[2] ?? "") + "0".repeat(pad);
5449
+ const exp3 = parseInt(m[2]);
5450
+ if (exp3 < 0) return null;
5451
+ s = m[1] + "0".repeat(exp3);
5453
5452
  }
5454
5453
  const i = s.indexOf(".");
5455
5454
  if (i >= 0) return null;
@@ -9760,6 +9759,23 @@ function serializeScientificNotationNumber(valString, options, expMultiple = 1)
9760
9759
  if (!m) return serializeAutoNotationNumber(valString, options);
9761
9760
  let exponent = parseInt(m[2]);
9762
9761
  let mantissa = m[1];
9762
+ {
9763
+ const signMatch = mantissa.match(/^(-?)/);
9764
+ const sign3 = signMatch ? signMatch[1] : "";
9765
+ const unsigned = sign3 ? mantissa.substring(1) : mantissa;
9766
+ const parts = unsigned.match(/^(\d+)(?:\.(\d*))?$/);
9767
+ if (parts) {
9768
+ let whole = parts[1];
9769
+ let fraction = parts[2] ?? "";
9770
+ if (whole.length > 1) {
9771
+ fraction = whole.slice(1) + fraction;
9772
+ exponent += whole.length - 1;
9773
+ whole = whole[0];
9774
+ }
9775
+ mantissa = sign3 + whole;
9776
+ if (fraction) mantissa += "." + fraction;
9777
+ }
9778
+ }
9763
9779
  if (Math.abs(exponent) % expMultiple !== 0) {
9764
9780
  const adjust = exponent > 0 ? exponent % expMultiple : -((expMultiple + exponent) % expMultiple);
9765
9781
  exponent = exponent >= 0 ? exponent - adjust : exponent + adjust;
@@ -11718,7 +11734,8 @@ var init_exact_numeric_value = __esm({
11718
11734
  }
11719
11735
  } else {
11720
11736
  console.assert(isSubtype(value.type, "integer"));
11721
- rationalSum = add2(rationalSum, [value.re, 1]);
11737
+ const intValue = BigInt(value.bignumRe.toFixed(0));
11738
+ rationalSum = add2(rationalSum, [intValue, BigInt(1)]);
11722
11739
  }
11723
11740
  }
11724
11741
  if (isZero(rationalSum) && radicals.length === 0) {
@@ -12084,11 +12101,14 @@ function canonicalDivide(op1, op2) {
12084
12101
  const ce = op1.engine;
12085
12102
  if (!op1.isValid || !op2.isValid) return ce._fn("Divide", [op1, op2]);
12086
12103
  if (op1.isNaN || op2.isNaN) return ce.NaN;
12087
- const op2IsConstantExpression = op2.symbols.length === 0 && !op2.isNumberLiteral;
12104
+ const op2IsConstantExpression = op2.unknowns.length === 0 && !op2.isNumberLiteral;
12088
12105
  if (op2.is(0)) return op1.is(0) ? ce.NaN : ce.ComplexInfinity;
12089
12106
  if (op1.is(0) && op2.isFinite !== false) {
12090
12107
  if (op2IsConstantExpression)
12091
- return ce._fn("Divide", [op1, op2], { canonical: false });
12108
+ return ce.function("Divide", [op1, op2], {
12109
+ canonical: false,
12110
+ structural: true
12111
+ });
12092
12112
  return ce.Zero;
12093
12113
  }
12094
12114
  if (op2.isInfinity) return op1.isInfinity ? ce.NaN : ce.Zero;
@@ -12097,7 +12117,10 @@ function canonicalDivide(op1, op2) {
12097
12117
  return ce.One;
12098
12118
  if (op1.isSame(op2)) {
12099
12119
  if (op2IsConstantExpression)
12100
- return ce._fn("Divide", [op1, op2], { canonical: false });
12120
+ return ce.function("Divide", [op1, op2], {
12121
+ canonical: false,
12122
+ structural: true
12123
+ });
12101
12124
  return ce.One;
12102
12125
  }
12103
12126
  }
@@ -15248,7 +15271,7 @@ function asRadical(expr) {
15248
15271
  }
15249
15272
  function canonicalPower(a, b) {
15250
15273
  const ce = a.engine;
15251
- const fullyCanonical = a.isCanonical && b.isCanonical;
15274
+ const fullyCanonical = (a.isCanonical || a.isStructural) && (b.isCanonical || b.isStructural);
15252
15275
  const unchanged = () => ce._fn("Power", [a, b], { canonical: fullyCanonical });
15253
15276
  if (a.operator === "Power") {
15254
15277
  const [base, aPow] = a.ops;
@@ -15294,7 +15317,7 @@ function canonicalPower(a, b) {
15294
15317
  if (a.is(-1)) return ce.NegativeOne;
15295
15318
  if (a.is(1)) return ce.One;
15296
15319
  }
15297
- if (!a.isCanonical)
15320
+ if (!(a.isCanonical || a.isStructural))
15298
15321
  return ce._fn("Power", [a, ce.number(-1)], { canonical: false });
15299
15322
  return a.inv();
15300
15323
  }
@@ -15350,10 +15373,10 @@ function canonicalPower(a, b) {
15350
15373
  }
15351
15374
  }
15352
15375
  if (b.is(0.5))
15353
- return a.isCanonical ? canonicalRoot(a, 2) : ce._fn("Sqrt", [a], { canonical: false });
15376
+ return a.isCanonical || a.isStructural ? canonicalRoot(a, 2) : ce._fn("Sqrt", [a], { canonical: false });
15354
15377
  const r = asRational(b);
15355
15378
  if (r !== void 0 && r[0] === 1 && r[1] !== 1)
15356
- return a.isCanonical ? canonicalRoot(a, ce.number(r[1])) : ce._fn("Root", [a, ce.number(r[1])], { canonical: false });
15379
+ return a.isCanonical || a.isStructural ? canonicalRoot(a, ce.number(r[1])) : ce._fn("Root", [a, ce.number(r[1])], { canonical: false });
15357
15380
  return unchanged();
15358
15381
  }
15359
15382
  function canonicalRoot(a, b) {
@@ -15372,14 +15395,14 @@ function canonicalRoot(a, b) {
15372
15395
  if (v.numericValue.isExact) return v;
15373
15396
  }
15374
15397
  }
15375
- return ce._fn("Sqrt", [a], { canonical: a.isCanonical });
15398
+ return ce._fn("Sqrt", [a], { canonical: a.isCanonical || a.isStructural });
15376
15399
  }
15377
15400
  return ce._fn("Root", [a, typeof b === "number" ? ce.number(b) : b], {
15378
- canonical: a.isCanonical && (typeof b === "number" || b.isCanonical)
15401
+ canonical: (a.isCanonical || a.isStructural) && (typeof b === "number" || b.isCanonical || b.isStructural)
15379
15402
  });
15380
15403
  }
15381
15404
  function pow2(x, exp3, { numericApproximation }) {
15382
- if (!x.isCanonical || typeof exp3 !== "number" && !exp3.isCanonical)
15405
+ if (!(x.isCanonical || x.isStructural) || typeof exp3 !== "number" && !(exp3.isCanonical || exp3.isStructural))
15383
15406
  return x.engine._fn("Power", [x, x.engine.box(exp3)], { canonical: false });
15384
15407
  if (numericApproximation) {
15385
15408
  if (x.isNumberLiteral) {
@@ -15475,7 +15498,7 @@ function pow2(x, exp3, { numericApproximation }) {
15475
15498
  return ce._fn("Power", [x, ce.box(exp3)]);
15476
15499
  }
15477
15500
  function root(a, b, { numericApproximation }) {
15478
- if (!a.isCanonical || !b.isCanonical)
15501
+ if (!(a.isCanonical || a.isStructural) || !(b.isCanonical || b.isStructural))
15479
15502
  return a.engine._fn("Root", [a, b], { canonical: false });
15480
15503
  if (numericApproximation) {
15481
15504
  if (a.isNumberLiteral && b.isNumberLiteral) {
@@ -15681,7 +15704,7 @@ function order(a, b) {
15681
15704
  return (a.complexity ?? DEFAULT_COMPLEXITY) - (b.complexity ?? DEFAULT_COMPLEXITY);
15682
15705
  }
15683
15706
  function canonicalOrder(expr, { recursive = false }) {
15684
- if (expr.isCanonical || !expr.ops) return expr;
15707
+ if (expr.isCanonical || expr.isStructural || !expr.ops) return expr;
15685
15708
  let ops = expr.ops;
15686
15709
  if (recursive) ops = ops.map((x) => canonicalOrder(x, { recursive }));
15687
15710
  ops = sortOperands(expr.operator, ops);
@@ -23795,6 +23818,24 @@ var init_utils5 = __esm({
23795
23818
  });
23796
23819
 
23797
23820
  // src/compute-engine/boxed-expression/validate.ts
23821
+ function typeCouldBeCollection(type2) {
23822
+ if (typeof type2 === "string") {
23823
+ return type2 === "collection" || type2 === "indexed_collection" || type2 === "list" || type2 === "set" || type2 === "tuple" || type2 === "any";
23824
+ }
23825
+ if (type2.kind === "list" || type2.kind === "set" || type2.kind === "tuple")
23826
+ return true;
23827
+ if (type2.kind === "union") return type2.types.some((t) => typeCouldBeCollection(t));
23828
+ return false;
23829
+ }
23830
+ function typeCouldBeNumericCollection(type2) {
23831
+ if (typeof type2 === "string") {
23832
+ return type2 === "list" || type2 === "set" || type2 === "collection" || type2 === "indexed_collection";
23833
+ }
23834
+ if (type2.kind === "list" || type2.kind === "set") return true;
23835
+ if (type2.kind === "union")
23836
+ return type2.types.some((t) => typeCouldBeNumericCollection(t));
23837
+ return false;
23838
+ }
23798
23839
  function checkArity(ce, ops, count) {
23799
23840
  ops = flatten(ops);
23800
23841
  if (!ce.strict) return ops;
@@ -23844,7 +23885,9 @@ function checkNumericArgs(ce, ops, options) {
23844
23885
  xs.push(op);
23845
23886
  } else if (op.symbol && !ce.lookupDefinition(op.symbol)) {
23846
23887
  xs.push(op);
23847
- } else if (op.type.isUnknown) {
23888
+ } else if (op.type.isUnknown || op.type.type === "any") {
23889
+ xs.push(op);
23890
+ } else if (typeCouldBeNumericCollection(op.type.type)) {
23848
23891
  xs.push(op);
23849
23892
  } else if (isBoxedTensor(op)) {
23850
23893
  xs.push(op);
@@ -23928,11 +23971,11 @@ function validateArguments(ce, ops, signature, lazy, threadable) {
23928
23971
  isValid = false;
23929
23972
  continue;
23930
23973
  }
23931
- if (op.type.isUnknown) {
23974
+ if (op.type.isUnknown || op.type.type === "any") {
23932
23975
  result.push(op);
23933
23976
  continue;
23934
23977
  }
23935
- if (threadable && isFiniteIndexedCollection(op)) {
23978
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
23936
23979
  result.push(op);
23937
23980
  continue;
23938
23981
  }
@@ -23967,12 +24010,12 @@ function validateArguments(ce, ops, signature, lazy, threadable) {
23967
24010
  i += 1;
23968
24011
  continue;
23969
24012
  }
23970
- if (op.type.isUnknown) {
24013
+ if (op.type.isUnknown || op.type.type === "any") {
23971
24014
  result.push(op);
23972
24015
  i += 1;
23973
24016
  continue;
23974
24017
  }
23975
- if (threadable && isFiniteIndexedCollection(op)) {
24018
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
23976
24019
  result.push(op);
23977
24020
  i += 1;
23978
24021
  continue;
@@ -24005,11 +24048,11 @@ function validateArguments(ce, ops, signature, lazy, threadable) {
24005
24048
  isValid = false;
24006
24049
  continue;
24007
24050
  }
24008
- if (op.type.isUnknown) {
24051
+ if (op.type.isUnknown || op.type.type === "any") {
24009
24052
  result.push(op);
24010
24053
  continue;
24011
24054
  }
24012
- if (threadable && isFiniteIndexedCollection(op)) {
24055
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
24013
24056
  result.push(op);
24014
24057
  continue;
24015
24058
  }
@@ -24039,20 +24082,22 @@ function validateArguments(ce, ops, signature, lazy, threadable) {
24039
24082
  i = 0;
24040
24083
  for (const param of params) {
24041
24084
  if (!lazy) {
24042
- if (!threadable || !isFiniteIndexedCollection(ops[i]))
24085
+ if (!threadable || !isFiniteIndexedCollection(ops[i]) && !typeCouldBeCollection(ops[i].type.type))
24043
24086
  ops[i].infer(param);
24044
24087
  }
24045
24088
  i += 1;
24046
24089
  }
24047
24090
  for (const param of optParams) {
24048
24091
  if (!ops[i]) break;
24049
- if (!threadable || !isFiniteIndexedCollection(ops[i])) ops[i]?.infer(param);
24092
+ if (!threadable || !isFiniteIndexedCollection(ops[i]) && !typeCouldBeCollection(ops[i].type.type))
24093
+ ops[i]?.infer(param);
24050
24094
  i += 1;
24051
24095
  }
24052
24096
  if (varParam) {
24053
24097
  for (const op of ops.slice(i)) {
24054
24098
  if (!lazy) {
24055
- if (!threadable || !isFiniteIndexedCollection(op)) op.infer(varParam);
24099
+ if (!threadable || !isFiniteIndexedCollection(op) && !typeCouldBeCollection(op.type.type))
24100
+ op.infer(varParam);
24056
24101
  }
24057
24102
  i += 1;
24058
24103
  }
@@ -35464,6 +35509,12 @@ function canonicalForm(expr, forms, scope) {
35464
35509
  throw Error("Invalid canonical form");
35465
35510
  }
35466
35511
  }
35512
+ if (expr.isFunctionExpression && expr.isCanonical) {
35513
+ expr = expr.engine.function(expr.operator, [...expr.ops], {
35514
+ canonical: false,
35515
+ structural: true
35516
+ });
35517
+ }
35467
35518
  return expr;
35468
35519
  }
35469
35520
  function flattenForm(expr) {
@@ -35545,10 +35596,7 @@ function multiplyForm(expr) {
35545
35596
  if (!expr.ops) return expr;
35546
35597
  const ops = expr.ops.map(multiplyForm);
35547
35598
  if (expr.operator === "Multiply")
35548
- return canonicalMultiply(
35549
- expr.engine,
35550
- ops.map((x) => x.canonical)
35551
- );
35599
+ return canonicalMultiply(expr.engine, ops);
35552
35600
  if (expr.operator === "Negate")
35553
35601
  return canonicalMultiply(expr.engine, [ops[0], expr.engine.NegativeOne]);
35554
35602
  return expr;
@@ -45682,7 +45730,7 @@ var BoxedFunction = class extends _BoxedExpression {
45682
45730
  return void 0;
45683
45731
  }
45684
45732
  get isCanonical() {
45685
- return this._def !== void 0 && this._def !== null;
45733
+ return this._def !== void 0 && this._def !== null && !this._isStructural;
45686
45734
  }
45687
45735
  get isPure() {
45688
45736
  if (this._isPure !== void 0) return this._isPure;
@@ -45849,7 +45897,7 @@ var BoxedFunction = class extends _BoxedExpression {
45849
45897
  subs(sub3, options) {
45850
45898
  options ??= { canonical: void 0 };
45851
45899
  if (options.canonical === void 0)
45852
- options = { canonical: this.isCanonical };
45900
+ options = { canonical: this.isCanonical || this.isStructural };
45853
45901
  const ops = this._ops.map((x) => x.subs(sub3, options));
45854
45902
  if (!ops.every((x) => x.isValid))
45855
45903
  return this.engine.function(this._operator, ops, { canonical: false });
@@ -45921,7 +45969,7 @@ var BoxedFunction = class extends _BoxedExpression {
45921
45969
  return this.numeratorDenominator[1];
45922
45970
  }
45923
45971
  get numeratorDenominator() {
45924
- if (!this.isCanonical) return [this, this.engine.One];
45972
+ if (!(this.isCanonical || this.isStructural)) return [this, this.engine.One];
45925
45973
  if (this.isNumber !== true)
45926
45974
  return [this.engine.Nothing, this.engine.Nothing];
45927
45975
  const operator2 = this.operator;
@@ -45959,11 +46007,11 @@ var BoxedFunction = class extends _BoxedExpression {
45959
46007
  // ALGEBRAIC OPERATIONS
45960
46008
  //
45961
46009
  neg() {
45962
- if (!this.isCanonical) throw new Error("Not canonical");
46010
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45963
46011
  return negate(this);
45964
46012
  }
45965
46013
  inv() {
45966
- if (!this.isCanonical) throw new Error("Not canonical");
46014
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45967
46015
  if (this.isOne) return this;
45968
46016
  if (this.isNegativeOne) return this;
45969
46017
  if (this.operator === "Sqrt") return this.op1.inv().sqrt();
@@ -45984,7 +46032,7 @@ var BoxedFunction = class extends _BoxedExpression {
45984
46032
  return this.engine._fn("Divide", [this.engine.One, this]);
45985
46033
  }
45986
46034
  abs() {
45987
- if (!this.isCanonical) throw new Error("Not canonical");
46035
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45988
46036
  if (this.operator === "Abs" || this.operator === "Negate") return this;
45989
46037
  if (this.isNonNegative) return this;
45990
46038
  if (this.isNonPositive) return this.neg();
@@ -45992,11 +46040,11 @@ var BoxedFunction = class extends _BoxedExpression {
45992
46040
  }
45993
46041
  add(rhs) {
45994
46042
  if (rhs === 0) return this;
45995
- if (!this.isCanonical) throw new Error("Not canonical");
46043
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45996
46044
  return add3(this, this.engine.box(rhs));
45997
46045
  }
45998
46046
  mul(rhs) {
45999
- if (!this.isCanonical) throw new Error("Not canonical");
46047
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46000
46048
  if (rhs === 0) return this.engine.Zero;
46001
46049
  if (rhs === 1) return this;
46002
46050
  if (rhs === -1) return this.neg();
@@ -46008,14 +46056,14 @@ var BoxedFunction = class extends _BoxedExpression {
46008
46056
  return mul3(this, this.engine.box(rhs));
46009
46057
  }
46010
46058
  div(rhs) {
46011
- if (!this.isCanonical) throw new Error("Not canonical");
46059
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46012
46060
  return div2(this, rhs);
46013
46061
  }
46014
46062
  pow(exp3) {
46015
46063
  return pow2(this, exp3, { numericApproximation: false });
46016
46064
  }
46017
46065
  root(exp3) {
46018
- if (!this.isCanonical || typeof exp3 !== "number" && !exp3.isCanonical)
46066
+ if (!(this.isCanonical || this.isStructural) || typeof exp3 !== "number" && !(exp3.isCanonical || exp3.isStructural))
46019
46067
  throw new Error("Not canonical");
46020
46068
  const e = typeof exp3 === "number" ? exp3 : exp3.im === 0 ? exp3.re : void 0;
46021
46069
  if (e === 0) return this.engine.NaN;
@@ -46074,7 +46122,7 @@ var BoxedFunction = class extends _BoxedExpression {
46074
46122
  }
46075
46123
  ln(semiBase) {
46076
46124
  const base = semiBase ? this.engine.box(semiBase) : void 0;
46077
- if (!this.isCanonical) throw new Error("Not canonical");
46125
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46078
46126
  if (this.is(0)) return this.engine.NegativeInfinity;
46079
46127
  if (this.operator === "Exp") {
46080
46128
  if (!base) return this.op1;
@@ -46107,7 +46155,7 @@ var BoxedFunction = class extends _BoxedExpression {
46107
46155
  return this.engine._fn("Ln", [this]);
46108
46156
  }
46109
46157
  get complexity() {
46110
- if (!this.isCanonical) return void 0;
46158
+ if (!(this.isCanonical || this.isStructural)) return void 0;
46111
46159
  return this.operatorDefinition?.complexity ?? DEFAULT_COMPLEXITY;
46112
46160
  }
46113
46161
  get baseDefinition() {
@@ -51437,6 +51485,13 @@ var JAVASCRIPT_FUNCTIONS = {
51437
51485
  },
51438
51486
  Exp: "Math.exp",
51439
51487
  Floor: "Math.floor",
51488
+ Fract: ([x], compile) => {
51489
+ if (x === null) throw new Error("Fract: no argument");
51490
+ return BaseCompiler.inlineExpression(
51491
+ "${x} - Math.floor(${x})",
51492
+ compile(x)
51493
+ );
51494
+ },
51440
51495
  Gamma: "_SYS.gamma",
51441
51496
  GCD: "_SYS.gcd",
51442
51497
  Integrate: (args, compile, target) => compileIntegrate(args, compile, target),
@@ -51870,6 +51925,87 @@ var GLSL_FUNCTIONS = {
51870
51925
  Sqrt: "sqrt",
51871
51926
  Step: "step",
51872
51927
  Tan: "tan",
51928
+ // Reciprocal trigonometric functions (no GLSL built-ins)
51929
+ Cot: ([x], compile) => {
51930
+ if (x === null) throw new Error("Cot: no argument");
51931
+ const arg = compile(x);
51932
+ return `(cos(${arg}) / sin(${arg}))`;
51933
+ },
51934
+ Csc: ([x], compile) => {
51935
+ if (x === null) throw new Error("Csc: no argument");
51936
+ return `(1.0 / sin(${compile(x)}))`;
51937
+ },
51938
+ Sec: ([x], compile) => {
51939
+ if (x === null) throw new Error("Sec: no argument");
51940
+ return `(1.0 / cos(${compile(x)}))`;
51941
+ },
51942
+ // Inverse trigonometric (reciprocal)
51943
+ Arccot: ([x], compile) => {
51944
+ if (x === null) throw new Error("Arccot: no argument");
51945
+ return `atan(1.0 / (${compile(x)}))`;
51946
+ },
51947
+ Arccsc: ([x], compile) => {
51948
+ if (x === null) throw new Error("Arccsc: no argument");
51949
+ return `asin(1.0 / (${compile(x)}))`;
51950
+ },
51951
+ Arcsec: ([x], compile) => {
51952
+ if (x === null) throw new Error("Arcsec: no argument");
51953
+ return `acos(1.0 / (${compile(x)}))`;
51954
+ },
51955
+ // Hyperbolic functions (GLSL ES 3.0+ built-ins)
51956
+ Sinh: "sinh",
51957
+ Cosh: "cosh",
51958
+ Tanh: "tanh",
51959
+ // Reciprocal hyperbolic functions
51960
+ Coth: ([x], compile) => {
51961
+ if (x === null) throw new Error("Coth: no argument");
51962
+ const arg = compile(x);
51963
+ return `(cosh(${arg}) / sinh(${arg}))`;
51964
+ },
51965
+ Csch: ([x], compile) => {
51966
+ if (x === null) throw new Error("Csch: no argument");
51967
+ return `(1.0 / sinh(${compile(x)}))`;
51968
+ },
51969
+ Sech: ([x], compile) => {
51970
+ if (x === null) throw new Error("Sech: no argument");
51971
+ return `(1.0 / cosh(${compile(x)}))`;
51972
+ },
51973
+ // Inverse hyperbolic functions (GLSL ES 3.0+ built-ins)
51974
+ Arcosh: "acosh",
51975
+ Arsinh: "asinh",
51976
+ Artanh: "atanh",
51977
+ // Inverse hyperbolic (reciprocal)
51978
+ Arcoth: ([x], compile) => {
51979
+ if (x === null) throw new Error("Arcoth: no argument");
51980
+ return `atanh(1.0 / (${compile(x)}))`;
51981
+ },
51982
+ Arcsch: ([x], compile) => {
51983
+ if (x === null) throw new Error("Arcsch: no argument");
51984
+ return `asinh(1.0 / (${compile(x)}))`;
51985
+ },
51986
+ Arsech: ([x], compile) => {
51987
+ if (x === null) throw new Error("Arsech: no argument");
51988
+ return `acosh(1.0 / (${compile(x)}))`;
51989
+ },
51990
+ // Additional math functions
51991
+ Sgn: "sign",
51992
+ Lb: "log2",
51993
+ Log: (args, compile) => {
51994
+ if (args.length === 0) throw new Error("Log: no argument");
51995
+ if (args.length === 1) return `(log(${compile(args[0])}) / log(10.0))`;
51996
+ return `(log(${compile(args[0])}) / log(${compile(args[1])}))`;
51997
+ },
51998
+ Square: ([x], compile) => {
51999
+ if (x === null) throw new Error("Square: no argument");
52000
+ const arg = compile(x);
52001
+ return `(${arg} * ${arg})`;
52002
+ },
52003
+ Root: ([x, n], compile) => {
52004
+ if (x === null) throw new Error("Root: no argument");
52005
+ if (n === null || n === void 0) return `sqrt(${compile(x)})`;
52006
+ if (n?.re === 2) return `sqrt(${compile(x)})`;
52007
+ return `pow(${compile(x)}, 1.0 / ${compile(n)})`;
52008
+ },
51873
52009
  // Vector/Matrix operations
51874
52010
  Cross: "cross",
51875
52011
  Distance: "distance",
@@ -52416,19 +52552,39 @@ function floor2(x) {
52416
52552
  const unwrapped = unwrapOrPropagate(x);
52417
52553
  if (!Array.isArray(unwrapped)) return unwrapped;
52418
52554
  const [xVal] = unwrapped;
52419
- return ok({ lo: Math.floor(xVal.lo), hi: Math.floor(xVal.hi) });
52555
+ const flo = Math.floor(xVal.lo);
52556
+ const fhi = Math.floor(xVal.hi);
52557
+ if (flo === fhi) return ok({ lo: flo, hi: fhi });
52558
+ return { kind: "singular", at: flo + 1 };
52420
52559
  }
52421
52560
  function ceil2(x) {
52422
52561
  const unwrapped = unwrapOrPropagate(x);
52423
52562
  if (!Array.isArray(unwrapped)) return unwrapped;
52424
52563
  const [xVal] = unwrapped;
52425
- return ok({ lo: Math.ceil(xVal.lo), hi: Math.ceil(xVal.hi) });
52564
+ const clo = Math.ceil(xVal.lo);
52565
+ const chi = Math.ceil(xVal.hi);
52566
+ if (clo === chi) return ok({ lo: clo, hi: chi });
52567
+ return { kind: "singular", at: clo };
52426
52568
  }
52427
52569
  function round2(x) {
52428
52570
  const unwrapped = unwrapOrPropagate(x);
52429
52571
  if (!Array.isArray(unwrapped)) return unwrapped;
52430
52572
  const [xVal] = unwrapped;
52431
- return ok({ lo: Math.round(xVal.lo), hi: Math.round(xVal.hi) });
52573
+ const rlo = Math.round(xVal.lo);
52574
+ const rhi = Math.round(xVal.hi);
52575
+ if (rlo === rhi) return ok({ lo: rlo, hi: rhi });
52576
+ return { kind: "singular", at: rlo + 0.5 };
52577
+ }
52578
+ function fract(x) {
52579
+ const unwrapped = unwrapOrPropagate(x);
52580
+ if (!Array.isArray(unwrapped)) return unwrapped;
52581
+ const [xVal] = unwrapped;
52582
+ const flo = Math.floor(xVal.lo);
52583
+ const fhi = Math.floor(xVal.hi);
52584
+ if (flo === fhi) {
52585
+ return ok({ lo: xVal.lo - flo, hi: xVal.hi - flo });
52586
+ }
52587
+ return { kind: "singular", at: flo + 1 };
52432
52588
  }
52433
52589
  function min2(a, b) {
52434
52590
  const unwrapped = unwrapOrPropagate(a, b);
@@ -52455,18 +52611,15 @@ function mod2(a, b) {
52455
52611
  if (containsZero(bVal)) {
52456
52612
  return { kind: "singular" };
52457
52613
  }
52458
- const bAbs = Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi));
52459
- const aWidth = aVal.hi - aVal.lo;
52460
- if (aWidth >= bAbs) {
52461
- return ok({ lo: 0, hi: bAbs });
52462
- }
52463
- const modLo = (aVal.lo % bAbs + bAbs) % bAbs;
52464
- const modHi = (aVal.hi % bAbs + bAbs) % bAbs;
52465
- if (modLo <= modHi) {
52466
- return ok({ lo: modLo, hi: modHi });
52467
- } else {
52468
- return ok({ lo: 0, hi: bAbs });
52614
+ const period = Math.abs(bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi)));
52615
+ const flo = Math.floor(aVal.lo / period);
52616
+ const fhi = Math.floor(aVal.hi / period);
52617
+ if (flo !== fhi) {
52618
+ return { kind: "singular", at: (flo + 1) * period };
52469
52619
  }
52620
+ const modLo = aVal.lo - period * flo;
52621
+ const modHi = aVal.hi - period * flo;
52622
+ return ok({ lo: Math.min(modLo, modHi), hi: Math.max(modLo, modHi) });
52470
52623
  }
52471
52624
  function sign2(x) {
52472
52625
  const unwrapped = unwrapOrPropagate(x);
@@ -52475,9 +52628,7 @@ function sign2(x) {
52475
52628
  if (xVal.lo > 0) return ok({ lo: 1, hi: 1 });
52476
52629
  if (xVal.hi < 0) return ok({ lo: -1, hi: -1 });
52477
52630
  if (xVal.lo === 0 && xVal.hi === 0) return ok({ lo: 0, hi: 0 });
52478
- if (xVal.lo < 0 && xVal.hi > 0) return ok({ lo: -1, hi: 1 });
52479
- if (xVal.lo === 0) return ok({ lo: 0, hi: 1 });
52480
- return ok({ lo: -1, hi: 0 });
52631
+ return { kind: "singular", at: 0 };
52481
52632
  }
52482
52633
 
52483
52634
  // src/compute-engine/interval/trigonometric.ts
@@ -52737,6 +52888,81 @@ function atanh2(x) {
52737
52888
  }
52738
52889
  return ok({ lo: Math.atanh(xVal.lo), hi: Math.atanh(xVal.hi) });
52739
52890
  }
52891
+ function acot(x) {
52892
+ const unwrapped = unwrapOrPropagate(x);
52893
+ if (!Array.isArray(unwrapped)) return unwrapped;
52894
+ const [xVal] = unwrapped;
52895
+ if (containsZero(xVal)) {
52896
+ return { kind: "singular", at: 0 };
52897
+ }
52898
+ return atan3(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52899
+ }
52900
+ function acsc(x) {
52901
+ const unwrapped = unwrapOrPropagate(x);
52902
+ if (!Array.isArray(unwrapped)) return unwrapped;
52903
+ const [xVal] = unwrapped;
52904
+ if (containsZero(xVal)) {
52905
+ return { kind: "singular", at: 0 };
52906
+ }
52907
+ return asin2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52908
+ }
52909
+ function asec(x) {
52910
+ const unwrapped = unwrapOrPropagate(x);
52911
+ if (!Array.isArray(unwrapped)) return unwrapped;
52912
+ const [xVal] = unwrapped;
52913
+ if (containsZero(xVal)) {
52914
+ return { kind: "singular", at: 0 };
52915
+ }
52916
+ return acos2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52917
+ }
52918
+ function coth(x) {
52919
+ const unwrapped = unwrapOrPropagate(x);
52920
+ if (!Array.isArray(unwrapped)) return unwrapped;
52921
+ const [xVal] = unwrapped;
52922
+ if (containsZero(xVal)) {
52923
+ return { kind: "singular", at: 0 };
52924
+ }
52925
+ return div3(cosh3(xVal), sinh3(xVal));
52926
+ }
52927
+ function csch(x) {
52928
+ const unwrapped = unwrapOrPropagate(x);
52929
+ if (!Array.isArray(unwrapped)) return unwrapped;
52930
+ const [xVal] = unwrapped;
52931
+ if (containsZero(xVal)) {
52932
+ return { kind: "singular", at: 0 };
52933
+ }
52934
+ return div3(ok({ lo: 1, hi: 1 }), sinh3(xVal));
52935
+ }
52936
+ function sech(x) {
52937
+ return div3(ok({ lo: 1, hi: 1 }), cosh3(x));
52938
+ }
52939
+ function acoth(x) {
52940
+ const unwrapped = unwrapOrPropagate(x);
52941
+ if (!Array.isArray(unwrapped)) return unwrapped;
52942
+ const [xVal] = unwrapped;
52943
+ if (containsZero(xVal)) {
52944
+ return { kind: "singular", at: 0 };
52945
+ }
52946
+ return atanh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52947
+ }
52948
+ function acsch(x) {
52949
+ const unwrapped = unwrapOrPropagate(x);
52950
+ if (!Array.isArray(unwrapped)) return unwrapped;
52951
+ const [xVal] = unwrapped;
52952
+ if (containsZero(xVal)) {
52953
+ return { kind: "singular", at: 0 };
52954
+ }
52955
+ return asinh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52956
+ }
52957
+ function asech(x) {
52958
+ const unwrapped = unwrapOrPropagate(x);
52959
+ if (!Array.isArray(unwrapped)) return unwrapped;
52960
+ const [xVal] = unwrapped;
52961
+ if (containsZero(xVal)) {
52962
+ return { kind: "singular", at: 0 };
52963
+ }
52964
+ return acosh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52965
+ }
52740
52966
 
52741
52967
  // src/compute-engine/interval/comparison.ts
52742
52968
  function less(a, b) {
@@ -52884,6 +53110,7 @@ var IntervalArithmetic = {
52884
53110
  floor: floor2,
52885
53111
  ceil: ceil2,
52886
53112
  round: round2,
53113
+ fract,
52887
53114
  min: min2,
52888
53115
  max: max2,
52889
53116
  mod: mod2,
@@ -52905,6 +53132,15 @@ var IntervalArithmetic = {
52905
53132
  asinh: asinh2,
52906
53133
  acosh: acosh2,
52907
53134
  atanh: atanh2,
53135
+ acot,
53136
+ acsc,
53137
+ asec,
53138
+ coth,
53139
+ csch,
53140
+ sech,
53141
+ acoth,
53142
+ acsch,
53143
+ asech,
52908
53144
  // Comparison
52909
53145
  less,
52910
53146
  lessEqual,
@@ -53049,17 +53285,28 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
53049
53285
  Arcsin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53050
53286
  Arccos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53051
53287
  Arctan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53288
+ Arccot: (args, compile) => `_IA.acot(${compile(args[0])})`,
53289
+ Arccsc: (args, compile) => `_IA.acsc(${compile(args[0])})`,
53290
+ Arcsec: (args, compile) => `_IA.asec(${compile(args[0])})`,
53052
53291
  // Hyperbolic functions
53053
53292
  Sinh: (args, compile) => `_IA.sinh(${compile(args[0])})`,
53054
53293
  Cosh: (args, compile) => `_IA.cosh(${compile(args[0])})`,
53055
53294
  Tanh: (args, compile) => `_IA.tanh(${compile(args[0])})`,
53295
+ Coth: (args, compile) => `_IA.coth(${compile(args[0])})`,
53296
+ Csch: (args, compile) => `_IA.csch(${compile(args[0])})`,
53297
+ Sech: (args, compile) => `_IA.sech(${compile(args[0])})`,
53056
53298
  Arsinh: (args, compile) => `_IA.asinh(${compile(args[0])})`,
53057
53299
  Arcosh: (args, compile) => `_IA.acosh(${compile(args[0])})`,
53058
53300
  Artanh: (args, compile) => `_IA.atanh(${compile(args[0])})`,
53301
+ Arcoth: (args, compile) => `_IA.acoth(${compile(args[0])})`,
53302
+ Arcsch: (args, compile) => `_IA.acsch(${compile(args[0])})`,
53303
+ Arsech: (args, compile) => `_IA.asech(${compile(args[0])})`,
53059
53304
  // Inverse trig (alternative names)
53060
53305
  Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53061
53306
  Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53062
53307
  Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53308
+ // Elementary
53309
+ Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
53063
53310
  // Mod
53064
53311
  Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
53065
53312
  // Conditionals
@@ -53382,24 +53629,94 @@ IntervalResult ia_abs(vec2 x) {
53382
53629
  return ia_ok(vec2(0.0, max(-x.x, x.y)));
53383
53630
  }
53384
53631
 
53385
- // Sign function
53632
+ // Sign function - has jump discontinuity at 0
53386
53633
  IntervalResult ia_sign(vec2 x) {
53387
53634
  if (x.x > 0.0) return ia_ok(vec2(1.0, 1.0));
53388
53635
  if (x.y < 0.0) return ia_ok(vec2(-1.0, -1.0));
53389
53636
  if (x.x == 0.0 && x.y == 0.0) return ia_ok(vec2(0.0, 0.0));
53390
- if (x.x < 0.0 && x.y > 0.0) return ia_ok(vec2(-1.0, 1.0));
53391
- if (x.x == 0.0) return ia_ok(vec2(0.0, 1.0));
53392
- return ia_ok(vec2(-1.0, 0.0));
53637
+ // Interval spans 0 - discontinuity
53638
+ return ia_singular(0.0);
53393
53639
  }
53394
53640
 
53395
- // Floor
53641
+ // Floor - has jump discontinuities at every integer
53396
53642
  IntervalResult ia_floor(vec2 x) {
53397
- return ia_ok(vec2(floor(x.x), floor(x.y)));
53643
+ float flo = floor(x.x);
53644
+ float fhi = floor(x.y);
53645
+ if (flo == fhi) {
53646
+ return ia_ok(vec2(flo, fhi));
53647
+ }
53648
+ // Interval spans an integer boundary - discontinuity at first integer > x.x
53649
+ return ia_singular(flo + 1.0);
53398
53650
  }
53399
53651
 
53400
- // Ceiling
53652
+ // Ceiling - has jump discontinuities at every integer
53401
53653
  IntervalResult ia_ceil(vec2 x) {
53402
- return ia_ok(vec2(ceil(x.x), ceil(x.y)));
53654
+ float clo = ceil(x.x);
53655
+ float chi = ceil(x.y);
53656
+ if (clo == chi) {
53657
+ return ia_ok(vec2(clo, chi));
53658
+ }
53659
+ // Interval spans an integer boundary - discontinuity at ceil(x.x)
53660
+ return ia_singular(clo);
53661
+ }
53662
+
53663
+ // Round - has jump discontinuities at every half-integer
53664
+ // Note: GLSL round() uses IEEE 754 round-half-to-even, while JS Math.round
53665
+ // uses round-half-up. They differ only AT half-integers; discontinuity
53666
+ // detection is safe because intervals spanning half-integers return singular.
53667
+ IntervalResult ia_round(vec2 x) {
53668
+ float rlo = round(x.x);
53669
+ float rhi = round(x.y);
53670
+ if (rlo == rhi) {
53671
+ return ia_ok(vec2(rlo, rhi));
53672
+ }
53673
+ // Interval spans a half-integer boundary - discontinuity
53674
+ return ia_singular(rlo + 0.5);
53675
+ }
53676
+
53677
+ // Fract - sawtooth discontinuities at every integer
53678
+ // fract(x) = x - floor(x), jumps from ~1 back to 0 at each integer
53679
+ IntervalResult ia_fract(vec2 x) {
53680
+ float flo = floor(x.x);
53681
+ float fhi = floor(x.y);
53682
+ if (flo == fhi) {
53683
+ // No integer crossing - fract is continuous (linear) on this interval
53684
+ return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
53685
+ }
53686
+ // Interval spans an integer - sawtooth discontinuity
53687
+ return ia_singular(flo + 1.0);
53688
+ }
53689
+
53690
+ // Mod - periodic discontinuities at multiples of the modulus
53691
+ // mod(x, y) = x - y * floor(x / y)
53692
+ IntervalResult ia_mod(vec2 x, vec2 y) {
53693
+ // y contains zero - undefined
53694
+ if (y.x <= 0.0 && y.y >= 0.0) {
53695
+ return ia_singular(0.0);
53696
+ }
53697
+
53698
+ // Constant modulus (point interval) - common case
53699
+ if (y.x == y.y) {
53700
+ float period = abs(y.x);
53701
+ float flo = floor(x.x / period);
53702
+ float fhi = floor(x.y / period);
53703
+ if (flo == fhi) {
53704
+ // No discontinuity - mod is continuous (linear) on this interval
53705
+ float mlo = x.x - period * flo;
53706
+ float mhi = x.y - period * flo;
53707
+ return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
53708
+ }
53709
+ // Discontinuity at first multiple of period in the interval
53710
+ return ia_singular((flo + 1.0) * period);
53711
+ }
53712
+
53713
+ // General case: compose from existing operations
53714
+ // Discontinuity detection comes from ia_floor
53715
+ IntervalResult q = ia_div(x, y);
53716
+ if (ia_is_error(q.status)) return q;
53717
+ IntervalResult fq = ia_floor(q.value);
53718
+ if (ia_is_error(fq.status)) return fq;
53719
+ return ia_sub(x, ia_mul_raw(y, fq.value));
53403
53720
  }
53404
53721
 
53405
53722
  // Min of two intervals
@@ -53688,6 +54005,32 @@ IntervalResult ia_ceil(IntervalResult x) {
53688
54005
  return ia_ceil(x.value);
53689
54006
  }
53690
54007
 
54008
+ IntervalResult ia_round(IntervalResult x) {
54009
+ if (ia_is_error(x.status)) return x;
54010
+ return ia_round(x.value);
54011
+ }
54012
+
54013
+ IntervalResult ia_fract(IntervalResult x) {
54014
+ if (ia_is_error(x.status)) return x;
54015
+ return ia_fract(x.value);
54016
+ }
54017
+
54018
+ IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
54019
+ if (ia_is_error(a.status)) return a;
54020
+ if (ia_is_error(b.status)) return b;
54021
+ return ia_mod(a.value, b.value);
54022
+ }
54023
+
54024
+ IntervalResult ia_mod(IntervalResult a, vec2 b) {
54025
+ if (ia_is_error(a.status)) return a;
54026
+ return ia_mod(a.value, b);
54027
+ }
54028
+
54029
+ IntervalResult ia_mod(vec2 a, IntervalResult b) {
54030
+ if (ia_is_error(b.status)) return b;
54031
+ return ia_mod(a, b.value);
54032
+ }
54033
+
53691
54034
  IntervalResult ia_min(IntervalResult a, IntervalResult b) {
53692
54035
  if (ia_is_error(a.status)) return a;
53693
54036
  if (ia_is_error(b.status)) return b;
@@ -53769,6 +54112,263 @@ IntervalResult ia_tanh(IntervalResult x) {
53769
54112
  if (ia_is_error(x.status)) return x;
53770
54113
  return ia_tanh(x.value);
53771
54114
  }
54115
+
54116
+ // Cotangent (derived from cos/sin)
54117
+ IntervalResult ia_cot(vec2 x) {
54118
+ return ia_div(ia_cos(x), ia_sin(x));
54119
+ }
54120
+
54121
+ IntervalResult ia_cot(IntervalResult x) {
54122
+ if (ia_is_error(x.status)) return x;
54123
+ return ia_cot(x.value);
54124
+ }
54125
+
54126
+ // Cosecant (derived from 1/sin)
54127
+ IntervalResult ia_csc(vec2 x) {
54128
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sin(x));
54129
+ }
54130
+
54131
+ IntervalResult ia_csc(IntervalResult x) {
54132
+ if (ia_is_error(x.status)) return x;
54133
+ return ia_csc(x.value);
54134
+ }
54135
+
54136
+ // Secant (derived from 1/cos)
54137
+ IntervalResult ia_sec(vec2 x) {
54138
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cos(x));
54139
+ }
54140
+
54141
+ IntervalResult ia_sec(IntervalResult x) {
54142
+ if (ia_is_error(x.status)) return x;
54143
+ return ia_sec(x.value);
54144
+ }
54145
+
54146
+ // Inverse cotangent
54147
+ IntervalResult ia_acot(vec2 x) {
54148
+ return ia_atan(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54149
+ }
54150
+
54151
+ IntervalResult ia_acot(IntervalResult x) {
54152
+ if (ia_is_error(x.status)) return x;
54153
+ return ia_acot(x.value);
54154
+ }
54155
+
54156
+ // Inverse cosecant
54157
+ IntervalResult ia_acsc(vec2 x) {
54158
+ return ia_asin(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54159
+ }
54160
+
54161
+ IntervalResult ia_acsc(IntervalResult x) {
54162
+ if (ia_is_error(x.status)) return x;
54163
+ return ia_acsc(x.value);
54164
+ }
54165
+
54166
+ // Inverse secant
54167
+ IntervalResult ia_asec(vec2 x) {
54168
+ return ia_acos(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54169
+ }
54170
+
54171
+ IntervalResult ia_asec(IntervalResult x) {
54172
+ if (ia_is_error(x.status)) return x;
54173
+ return ia_asec(x.value);
54174
+ }
54175
+
54176
+ // Hyperbolic cotangent
54177
+ IntervalResult ia_coth(vec2 x) {
54178
+ return ia_div(ia_cosh(x), ia_sinh(x));
54179
+ }
54180
+
54181
+ IntervalResult ia_coth(IntervalResult x) {
54182
+ if (ia_is_error(x.status)) return x;
54183
+ return ia_coth(x.value);
54184
+ }
54185
+
54186
+ // Hyperbolic cosecant
54187
+ IntervalResult ia_csch(vec2 x) {
54188
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sinh(x));
54189
+ }
54190
+
54191
+ IntervalResult ia_csch(IntervalResult x) {
54192
+ if (ia_is_error(x.status)) return x;
54193
+ return ia_csch(x.value);
54194
+ }
54195
+
54196
+ // Hyperbolic secant
54197
+ IntervalResult ia_sech(vec2 x) {
54198
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cosh(x));
54199
+ }
54200
+
54201
+ IntervalResult ia_sech(IntervalResult x) {
54202
+ if (ia_is_error(x.status)) return x;
54203
+ return ia_sech(x.value);
54204
+ }
54205
+
54206
+ // Inverse hyperbolic sine
54207
+ IntervalResult ia_asinh(vec2 x) {
54208
+ return ia_ok(vec2(asinh(x.x) - IA_EPS, asinh(x.y) + IA_EPS));
54209
+ }
54210
+
54211
+ IntervalResult ia_asinh(IntervalResult x) {
54212
+ if (ia_is_error(x.status)) return x;
54213
+ return ia_asinh(x.value);
54214
+ }
54215
+
54216
+ // Inverse hyperbolic cosine
54217
+ IntervalResult ia_acosh(vec2 x) {
54218
+ if (x.y < 1.0) {
54219
+ return ia_empty();
54220
+ }
54221
+ if (x.x >= 1.0) {
54222
+ return ia_ok(vec2(acosh(x.x) - IA_EPS, acosh(x.y) + IA_EPS));
54223
+ }
54224
+ return ia_partial(vec2(0.0, acosh(x.y) + IA_EPS), IA_PARTIAL_LO);
54225
+ }
54226
+
54227
+ IntervalResult ia_acosh(IntervalResult x) {
54228
+ if (ia_is_error(x.status)) return x;
54229
+ return ia_acosh(x.value);
54230
+ }
54231
+
54232
+ // Inverse hyperbolic tangent
54233
+ IntervalResult ia_atanh(vec2 x) {
54234
+ if (x.x >= 1.0 || x.y <= -1.0) {
54235
+ return ia_empty();
54236
+ }
54237
+ vec2 clipped = vec2(max(x.x, -1.0 + IA_EPS), min(x.y, 1.0 - IA_EPS));
54238
+ if (x.x < -1.0 || x.y > 1.0) {
54239
+ float clip = (x.x < -1.0 && x.y > 1.0) ? IA_PARTIAL_BOTH :
54240
+ (x.x < -1.0) ? IA_PARTIAL_LO : IA_PARTIAL_HI;
54241
+ return ia_partial(vec2(atanh(clipped.x) - IA_EPS, atanh(clipped.y) + IA_EPS), clip);
54242
+ }
54243
+ return ia_ok(vec2(atanh(x.x) - IA_EPS, atanh(x.y) + IA_EPS));
54244
+ }
54245
+
54246
+ IntervalResult ia_atanh(IntervalResult x) {
54247
+ if (ia_is_error(x.status)) return x;
54248
+ return ia_atanh(x.value);
54249
+ }
54250
+
54251
+ // Inverse hyperbolic cotangent
54252
+ IntervalResult ia_acoth(vec2 x) {
54253
+ return ia_atanh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54254
+ }
54255
+
54256
+ IntervalResult ia_acoth(IntervalResult x) {
54257
+ if (ia_is_error(x.status)) return x;
54258
+ return ia_acoth(x.value);
54259
+ }
54260
+
54261
+ // Inverse hyperbolic cosecant
54262
+ IntervalResult ia_acsch(vec2 x) {
54263
+ return ia_asinh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54264
+ }
54265
+
54266
+ IntervalResult ia_acsch(IntervalResult x) {
54267
+ if (ia_is_error(x.status)) return x;
54268
+ return ia_acsch(x.value);
54269
+ }
54270
+
54271
+ // Inverse hyperbolic secant
54272
+ IntervalResult ia_asech(vec2 x) {
54273
+ return ia_acosh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54274
+ }
54275
+
54276
+ IntervalResult ia_asech(IntervalResult x) {
54277
+ if (ia_is_error(x.status)) return x;
54278
+ return ia_asech(x.value);
54279
+ }
54280
+
54281
+ // Boolean interval comparisons
54282
+ // Returns 1.0 = true, 0.0 = false, 0.5 = maybe
54283
+ const float IA_TRUE = 1.0;
54284
+ const float IA_FALSE = 0.0;
54285
+ const float IA_MAYBE = 0.5;
54286
+
54287
+ float ia_less(vec2 a, vec2 b) {
54288
+ if (a.y < b.x) return IA_TRUE;
54289
+ if (a.x >= b.y) return IA_FALSE;
54290
+ return IA_MAYBE;
54291
+ }
54292
+
54293
+ float ia_lessEqual(vec2 a, vec2 b) {
54294
+ if (a.y <= b.x) return IA_TRUE;
54295
+ if (a.x > b.y) return IA_FALSE;
54296
+ return IA_MAYBE;
54297
+ }
54298
+
54299
+ float ia_greater(vec2 a, vec2 b) {
54300
+ if (a.x > b.y) return IA_TRUE;
54301
+ if (a.y <= b.x) return IA_FALSE;
54302
+ return IA_MAYBE;
54303
+ }
54304
+
54305
+ float ia_greaterEqual(vec2 a, vec2 b) {
54306
+ if (a.x >= b.y) return IA_TRUE;
54307
+ if (a.y < b.x) return IA_FALSE;
54308
+ return IA_MAYBE;
54309
+ }
54310
+
54311
+ float ia_equal(vec2 a, vec2 b) {
54312
+ if (a.x == a.y && b.x == b.y && a.x == b.x) return IA_TRUE;
54313
+ if (a.y < b.x || b.y < a.x) return IA_FALSE;
54314
+ return IA_MAYBE;
54315
+ }
54316
+
54317
+ float ia_notEqual(vec2 a, vec2 b) {
54318
+ float eq = ia_equal(a, b);
54319
+ if (eq == IA_TRUE) return IA_FALSE;
54320
+ if (eq == IA_FALSE) return IA_TRUE;
54321
+ return IA_MAYBE;
54322
+ }
54323
+
54324
+ float ia_and(float a, float b) {
54325
+ if (a == IA_FALSE || b == IA_FALSE) return IA_FALSE;
54326
+ if (a == IA_TRUE && b == IA_TRUE) return IA_TRUE;
54327
+ return IA_MAYBE;
54328
+ }
54329
+
54330
+ float ia_or(float a, float b) {
54331
+ if (a == IA_TRUE || b == IA_TRUE) return IA_TRUE;
54332
+ if (a == IA_FALSE && b == IA_FALSE) return IA_FALSE;
54333
+ return IA_MAYBE;
54334
+ }
54335
+
54336
+ float ia_not(float a) {
54337
+ if (a == IA_TRUE) return IA_FALSE;
54338
+ if (a == IA_FALSE) return IA_TRUE;
54339
+ return IA_MAYBE;
54340
+ }
54341
+
54342
+ // IntervalResult overloads for comparisons
54343
+ float ia_less(IntervalResult a, IntervalResult b) {
54344
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54345
+ return ia_less(a.value, b.value);
54346
+ }
54347
+
54348
+ float ia_lessEqual(IntervalResult a, IntervalResult b) {
54349
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54350
+ return ia_lessEqual(a.value, b.value);
54351
+ }
54352
+
54353
+ float ia_greater(IntervalResult a, IntervalResult b) {
54354
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54355
+ return ia_greater(a.value, b.value);
54356
+ }
54357
+
54358
+ float ia_greaterEqual(IntervalResult a, IntervalResult b) {
54359
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54360
+ return ia_greaterEqual(a.value, b.value);
54361
+ }
54362
+
54363
+ float ia_equal(IntervalResult a, IntervalResult b) {
54364
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54365
+ return ia_equal(a.value, b.value);
54366
+ }
54367
+
54368
+ float ia_notEqual(IntervalResult a, IntervalResult b) {
54369
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54370
+ return ia_notEqual(a.value, b.value);
54371
+ }
53772
54372
  `;
53773
54373
  var INTERVAL_GLSL_OPERATORS = {
53774
54374
  Add: ["ia_add", 20],
@@ -53820,7 +54420,9 @@ var INTERVAL_GLSL_FUNCTIONS = {
53820
54420
  Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
53821
54421
  Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
53822
54422
  Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
54423
+ Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
53823
54424
  Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
54425
+ Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
53824
54426
  Max: (args, compile) => {
53825
54427
  if (args.length === 0) return "ia_point(-1e38)";
53826
54428
  if (args.length === 1) return compile(args[0]);
@@ -53853,6 +54455,7 @@ var INTERVAL_GLSL_FUNCTIONS = {
53853
54455
  }
53854
54456
  throw new Error("Interval GLSL does not support variable exponents");
53855
54457
  },
54458
+ Round: (args, compile) => `ia_round(${compile(args[0])})`,
53856
54459
  Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
53857
54460
  Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
53858
54461
  Square: (args, compile) => `ia_square(${compile(args[0])})`,
@@ -53863,10 +54466,40 @@ var INTERVAL_GLSL_FUNCTIONS = {
53863
54466
  Arcsin: (args, compile) => `ia_asin(${compile(args[0])})`,
53864
54467
  Arccos: (args, compile) => `ia_acos(${compile(args[0])})`,
53865
54468
  Arctan: (args, compile) => `ia_atan(${compile(args[0])})`,
54469
+ // Reciprocal trigonometric functions
54470
+ Cot: (args, compile) => `ia_cot(${compile(args[0])})`,
54471
+ Csc: (args, compile) => `ia_csc(${compile(args[0])})`,
54472
+ Sec: (args, compile) => `ia_sec(${compile(args[0])})`,
54473
+ // Inverse trigonometric (reciprocal)
54474
+ Arccot: (args, compile) => `ia_acot(${compile(args[0])})`,
54475
+ Arccsc: (args, compile) => `ia_acsc(${compile(args[0])})`,
54476
+ Arcsec: (args, compile) => `ia_asec(${compile(args[0])})`,
53866
54477
  // Hyperbolic functions
53867
54478
  Sinh: (args, compile) => `ia_sinh(${compile(args[0])})`,
53868
54479
  Cosh: (args, compile) => `ia_cosh(${compile(args[0])})`,
53869
- Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`
54480
+ Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`,
54481
+ // Reciprocal hyperbolic functions
54482
+ Coth: (args, compile) => `ia_coth(${compile(args[0])})`,
54483
+ Csch: (args, compile) => `ia_csch(${compile(args[0])})`,
54484
+ Sech: (args, compile) => `ia_sech(${compile(args[0])})`,
54485
+ // Inverse hyperbolic functions
54486
+ Arsinh: (args, compile) => `ia_asinh(${compile(args[0])})`,
54487
+ Arcosh: (args, compile) => `ia_acosh(${compile(args[0])})`,
54488
+ Artanh: (args, compile) => `ia_atanh(${compile(args[0])})`,
54489
+ // Inverse hyperbolic (reciprocal)
54490
+ Arcoth: (args, compile) => `ia_acoth(${compile(args[0])})`,
54491
+ Arcsch: (args, compile) => `ia_acsch(${compile(args[0])})`,
54492
+ Arsech: (args, compile) => `ia_asech(${compile(args[0])})`,
54493
+ // Comparison and logic (return float: 1.0=true, 0.0=false, 0.5=maybe)
54494
+ Equal: (args, compile) => `ia_equal(${compile(args[0])}, ${compile(args[1])})`,
54495
+ NotEqual: (args, compile) => `ia_notEqual(${compile(args[0])}, ${compile(args[1])})`,
54496
+ Less: (args, compile) => `ia_less(${compile(args[0])}, ${compile(args[1])})`,
54497
+ LessEqual: (args, compile) => `ia_lessEqual(${compile(args[0])}, ${compile(args[1])})`,
54498
+ Greater: (args, compile) => `ia_greater(${compile(args[0])}, ${compile(args[1])})`,
54499
+ GreaterEqual: (args, compile) => `ia_greaterEqual(${compile(args[0])}, ${compile(args[1])})`,
54500
+ And: (args, compile) => `ia_and(${compile(args[0])}, ${compile(args[1])})`,
54501
+ Or: (args, compile) => `ia_or(${compile(args[0])}, ${compile(args[1])})`,
54502
+ Not: (args, compile) => `ia_not(${compile(args[0])})`
53870
54503
  };
53871
54504
  var IntervalGLSLTarget = class {
53872
54505
  getOperators() {
@@ -54694,12 +55327,11 @@ var ComputeEngine = class _ComputeEngine {
54694
55327
  bignum
54695
55328
  );
54696
55329
  if (value instanceof Decimal) {
54697
- if (value.isInteger() && value.e <= MAX_BIGINT_DIGITS)
54698
- return new ExactNumericValue(
54699
- bigint(value.toString()),
54700
- makeNumericValue,
54701
- bignum
54702
- );
55330
+ if (value.isInteger() && value.e <= MAX_BIGINT_DIGITS) {
55331
+ const n = bigint(value.toString());
55332
+ if (n !== null)
55333
+ return new ExactNumericValue(n, makeNumericValue, bignum);
55334
+ }
54703
55335
  return makeNumericValue(value);
54704
55336
  }
54705
55337
  if (value instanceof Complex) {
@@ -55765,10 +56397,10 @@ function defToString(name, def, v) {
55765
56397
  // src/compute-engine.ts
55766
56398
  init_types6();
55767
56399
  init_base_compiler();
55768
- var version = "0.35.1";
56400
+ var version = "0.35.3";
55769
56401
  globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
55770
56402
  ComputeEngine: ComputeEngine.prototype.constructor,
55771
- version: "0.35.1"
56403
+ version: "0.35.3"
55772
56404
  };
55773
56405
  export {
55774
56406
  BaseCompiler,