@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
  (function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComputeEngine = {}));})(this, (function (exports) { 'use strict';
3
3
  var ComputeEngine = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -5443,15 +5443,14 @@ var ComputeEngine = (() => {
5443
5443
  }
5444
5444
  if (a instanceof Decimal) {
5445
5445
  if (!a.isInteger()) return null;
5446
- return bigint(a.toString());
5446
+ return BigInt(a.toFixed(0));
5447
5447
  }
5448
5448
  let s = a.toLowerCase();
5449
- const m = s.match(/([+-]?[0-9]*)(?:\.([0-9]+))?e([+-]?[0-9]+)$/);
5449
+ const m = s.match(/^([+-]?[0-9]+)e([+-]?[0-9]+)$/);
5450
5450
  if (m) {
5451
- const exp3 = parseInt(m[3]);
5452
- const pad = exp3 - (m[2] ? m[2].length : 0);
5453
- if (pad < 0) return null;
5454
- s = (m[1] ?? "") + (m[2] ?? "") + "0".repeat(pad);
5451
+ const exp3 = parseInt(m[2]);
5452
+ if (exp3 < 0) return null;
5453
+ s = m[1] + "0".repeat(exp3);
5455
5454
  }
5456
5455
  const i = s.indexOf(".");
5457
5456
  if (i >= 0) return null;
@@ -9762,6 +9761,23 @@ var ComputeEngine = (() => {
9762
9761
  if (!m) return serializeAutoNotationNumber(valString, options);
9763
9762
  let exponent = parseInt(m[2]);
9764
9763
  let mantissa = m[1];
9764
+ {
9765
+ const signMatch = mantissa.match(/^(-?)/);
9766
+ const sign3 = signMatch ? signMatch[1] : "";
9767
+ const unsigned = sign3 ? mantissa.substring(1) : mantissa;
9768
+ const parts = unsigned.match(/^(\d+)(?:\.(\d*))?$/);
9769
+ if (parts) {
9770
+ let whole = parts[1];
9771
+ let fraction = parts[2] ?? "";
9772
+ if (whole.length > 1) {
9773
+ fraction = whole.slice(1) + fraction;
9774
+ exponent += whole.length - 1;
9775
+ whole = whole[0];
9776
+ }
9777
+ mantissa = sign3 + whole;
9778
+ if (fraction) mantissa += "." + fraction;
9779
+ }
9780
+ }
9765
9781
  if (Math.abs(exponent) % expMultiple !== 0) {
9766
9782
  const adjust = exponent > 0 ? exponent % expMultiple : -((expMultiple + exponent) % expMultiple);
9767
9783
  exponent = exponent >= 0 ? exponent - adjust : exponent + adjust;
@@ -11720,7 +11736,8 @@ var ComputeEngine = (() => {
11720
11736
  }
11721
11737
  } else {
11722
11738
  console.assert(isSubtype(value.type, "integer"));
11723
- rationalSum = add2(rationalSum, [value.re, 1]);
11739
+ const intValue = BigInt(value.bignumRe.toFixed(0));
11740
+ rationalSum = add2(rationalSum, [intValue, BigInt(1)]);
11724
11741
  }
11725
11742
  }
11726
11743
  if (isZero(rationalSum) && radicals.length === 0) {
@@ -12086,11 +12103,14 @@ var ComputeEngine = (() => {
12086
12103
  const ce = op1.engine;
12087
12104
  if (!op1.isValid || !op2.isValid) return ce._fn("Divide", [op1, op2]);
12088
12105
  if (op1.isNaN || op2.isNaN) return ce.NaN;
12089
- const op2IsConstantExpression = op2.symbols.length === 0 && !op2.isNumberLiteral;
12106
+ const op2IsConstantExpression = op2.unknowns.length === 0 && !op2.isNumberLiteral;
12090
12107
  if (op2.is(0)) return op1.is(0) ? ce.NaN : ce.ComplexInfinity;
12091
12108
  if (op1.is(0) && op2.isFinite !== false) {
12092
12109
  if (op2IsConstantExpression)
12093
- return ce._fn("Divide", [op1, op2], { canonical: false });
12110
+ return ce.function("Divide", [op1, op2], {
12111
+ canonical: false,
12112
+ structural: true
12113
+ });
12094
12114
  return ce.Zero;
12095
12115
  }
12096
12116
  if (op2.isInfinity) return op1.isInfinity ? ce.NaN : ce.Zero;
@@ -12099,7 +12119,10 @@ var ComputeEngine = (() => {
12099
12119
  return ce.One;
12100
12120
  if (op1.isSame(op2)) {
12101
12121
  if (op2IsConstantExpression)
12102
- return ce._fn("Divide", [op1, op2], { canonical: false });
12122
+ return ce.function("Divide", [op1, op2], {
12123
+ canonical: false,
12124
+ structural: true
12125
+ });
12103
12126
  return ce.One;
12104
12127
  }
12105
12128
  }
@@ -15250,7 +15273,7 @@ var ComputeEngine = (() => {
15250
15273
  }
15251
15274
  function canonicalPower(a, b) {
15252
15275
  const ce = a.engine;
15253
- const fullyCanonical = a.isCanonical && b.isCanonical;
15276
+ const fullyCanonical = (a.isCanonical || a.isStructural) && (b.isCanonical || b.isStructural);
15254
15277
  const unchanged = () => ce._fn("Power", [a, b], { canonical: fullyCanonical });
15255
15278
  if (a.operator === "Power") {
15256
15279
  const [base, aPow] = a.ops;
@@ -15296,7 +15319,7 @@ var ComputeEngine = (() => {
15296
15319
  if (a.is(-1)) return ce.NegativeOne;
15297
15320
  if (a.is(1)) return ce.One;
15298
15321
  }
15299
- if (!a.isCanonical)
15322
+ if (!(a.isCanonical || a.isStructural))
15300
15323
  return ce._fn("Power", [a, ce.number(-1)], { canonical: false });
15301
15324
  return a.inv();
15302
15325
  }
@@ -15352,10 +15375,10 @@ var ComputeEngine = (() => {
15352
15375
  }
15353
15376
  }
15354
15377
  if (b.is(0.5))
15355
- return a.isCanonical ? canonicalRoot(a, 2) : ce._fn("Sqrt", [a], { canonical: false });
15378
+ return a.isCanonical || a.isStructural ? canonicalRoot(a, 2) : ce._fn("Sqrt", [a], { canonical: false });
15356
15379
  const r = asRational(b);
15357
15380
  if (r !== void 0 && r[0] === 1 && r[1] !== 1)
15358
- return a.isCanonical ? canonicalRoot(a, ce.number(r[1])) : ce._fn("Root", [a, ce.number(r[1])], { canonical: false });
15381
+ return a.isCanonical || a.isStructural ? canonicalRoot(a, ce.number(r[1])) : ce._fn("Root", [a, ce.number(r[1])], { canonical: false });
15359
15382
  return unchanged();
15360
15383
  }
15361
15384
  function canonicalRoot(a, b) {
@@ -15374,14 +15397,14 @@ var ComputeEngine = (() => {
15374
15397
  if (v.numericValue.isExact) return v;
15375
15398
  }
15376
15399
  }
15377
- return ce._fn("Sqrt", [a], { canonical: a.isCanonical });
15400
+ return ce._fn("Sqrt", [a], { canonical: a.isCanonical || a.isStructural });
15378
15401
  }
15379
15402
  return ce._fn("Root", [a, typeof b === "number" ? ce.number(b) : b], {
15380
- canonical: a.isCanonical && (typeof b === "number" || b.isCanonical)
15403
+ canonical: (a.isCanonical || a.isStructural) && (typeof b === "number" || b.isCanonical || b.isStructural)
15381
15404
  });
15382
15405
  }
15383
15406
  function pow2(x, exp3, { numericApproximation }) {
15384
- if (!x.isCanonical || typeof exp3 !== "number" && !exp3.isCanonical)
15407
+ if (!(x.isCanonical || x.isStructural) || typeof exp3 !== "number" && !(exp3.isCanonical || exp3.isStructural))
15385
15408
  return x.engine._fn("Power", [x, x.engine.box(exp3)], { canonical: false });
15386
15409
  if (numericApproximation) {
15387
15410
  if (x.isNumberLiteral) {
@@ -15477,7 +15500,7 @@ var ComputeEngine = (() => {
15477
15500
  return ce._fn("Power", [x, ce.box(exp3)]);
15478
15501
  }
15479
15502
  function root(a, b, { numericApproximation }) {
15480
- if (!a.isCanonical || !b.isCanonical)
15503
+ if (!(a.isCanonical || a.isStructural) || !(b.isCanonical || b.isStructural))
15481
15504
  return a.engine._fn("Root", [a, b], { canonical: false });
15482
15505
  if (numericApproximation) {
15483
15506
  if (a.isNumberLiteral && b.isNumberLiteral) {
@@ -15683,7 +15706,7 @@ var ComputeEngine = (() => {
15683
15706
  return (a.complexity ?? DEFAULT_COMPLEXITY) - (b.complexity ?? DEFAULT_COMPLEXITY);
15684
15707
  }
15685
15708
  function canonicalOrder(expr, { recursive = false }) {
15686
- if (expr.isCanonical || !expr.ops) return expr;
15709
+ if (expr.isCanonical || expr.isStructural || !expr.ops) return expr;
15687
15710
  let ops = expr.ops;
15688
15711
  if (recursive) ops = ops.map((x) => canonicalOrder(x, { recursive }));
15689
15712
  ops = sortOperands(expr.operator, ops);
@@ -23797,6 +23820,24 @@ ${e.message}`);
23797
23820
  });
23798
23821
 
23799
23822
  // src/compute-engine/boxed-expression/validate.ts
23823
+ function typeCouldBeCollection(type2) {
23824
+ if (typeof type2 === "string") {
23825
+ return type2 === "collection" || type2 === "indexed_collection" || type2 === "list" || type2 === "set" || type2 === "tuple" || type2 === "any";
23826
+ }
23827
+ if (type2.kind === "list" || type2.kind === "set" || type2.kind === "tuple")
23828
+ return true;
23829
+ if (type2.kind === "union") return type2.types.some((t) => typeCouldBeCollection(t));
23830
+ return false;
23831
+ }
23832
+ function typeCouldBeNumericCollection(type2) {
23833
+ if (typeof type2 === "string") {
23834
+ return type2 === "list" || type2 === "set" || type2 === "collection" || type2 === "indexed_collection";
23835
+ }
23836
+ if (type2.kind === "list" || type2.kind === "set") return true;
23837
+ if (type2.kind === "union")
23838
+ return type2.types.some((t) => typeCouldBeNumericCollection(t));
23839
+ return false;
23840
+ }
23800
23841
  function checkArity(ce, ops, count) {
23801
23842
  ops = flatten(ops);
23802
23843
  if (!ce.strict) return ops;
@@ -23846,7 +23887,9 @@ ${e.message}`);
23846
23887
  xs.push(op);
23847
23888
  } else if (op.symbol && !ce.lookupDefinition(op.symbol)) {
23848
23889
  xs.push(op);
23849
- } else if (op.type.isUnknown) {
23890
+ } else if (op.type.isUnknown || op.type.type === "any") {
23891
+ xs.push(op);
23892
+ } else if (typeCouldBeNumericCollection(op.type.type)) {
23850
23893
  xs.push(op);
23851
23894
  } else if (isBoxedTensor(op)) {
23852
23895
  xs.push(op);
@@ -23930,11 +23973,11 @@ ${e.message}`);
23930
23973
  isValid = false;
23931
23974
  continue;
23932
23975
  }
23933
- if (op.type.isUnknown) {
23976
+ if (op.type.isUnknown || op.type.type === "any") {
23934
23977
  result.push(op);
23935
23978
  continue;
23936
23979
  }
23937
- if (threadable && isFiniteIndexedCollection(op)) {
23980
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
23938
23981
  result.push(op);
23939
23982
  continue;
23940
23983
  }
@@ -23969,12 +24012,12 @@ ${e.message}`);
23969
24012
  i += 1;
23970
24013
  continue;
23971
24014
  }
23972
- if (op.type.isUnknown) {
24015
+ if (op.type.isUnknown || op.type.type === "any") {
23973
24016
  result.push(op);
23974
24017
  i += 1;
23975
24018
  continue;
23976
24019
  }
23977
- if (threadable && isFiniteIndexedCollection(op)) {
24020
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
23978
24021
  result.push(op);
23979
24022
  i += 1;
23980
24023
  continue;
@@ -24007,11 +24050,11 @@ ${e.message}`);
24007
24050
  isValid = false;
24008
24051
  continue;
24009
24052
  }
24010
- if (op.type.isUnknown) {
24053
+ if (op.type.isUnknown || op.type.type === "any") {
24011
24054
  result.push(op);
24012
24055
  continue;
24013
24056
  }
24014
- if (threadable && isFiniteIndexedCollection(op)) {
24057
+ if (threadable && (isFiniteIndexedCollection(op) || typeCouldBeCollection(op.type.type))) {
24015
24058
  result.push(op);
24016
24059
  continue;
24017
24060
  }
@@ -24041,20 +24084,22 @@ ${e.message}`);
24041
24084
  i = 0;
24042
24085
  for (const param of params) {
24043
24086
  if (!lazy) {
24044
- if (!threadable || !isFiniteIndexedCollection(ops[i]))
24087
+ if (!threadable || !isFiniteIndexedCollection(ops[i]) && !typeCouldBeCollection(ops[i].type.type))
24045
24088
  ops[i].infer(param);
24046
24089
  }
24047
24090
  i += 1;
24048
24091
  }
24049
24092
  for (const param of optParams) {
24050
24093
  if (!ops[i]) break;
24051
- if (!threadable || !isFiniteIndexedCollection(ops[i])) ops[i]?.infer(param);
24094
+ if (!threadable || !isFiniteIndexedCollection(ops[i]) && !typeCouldBeCollection(ops[i].type.type))
24095
+ ops[i]?.infer(param);
24052
24096
  i += 1;
24053
24097
  }
24054
24098
  if (varParam) {
24055
24099
  for (const op of ops.slice(i)) {
24056
24100
  if (!lazy) {
24057
- if (!threadable || !isFiniteIndexedCollection(op)) op.infer(varParam);
24101
+ if (!threadable || !isFiniteIndexedCollection(op) && !typeCouldBeCollection(op.type.type))
24102
+ op.infer(varParam);
24058
24103
  }
24059
24104
  i += 1;
24060
24105
  }
@@ -35478,6 +35523,12 @@ ${lines.join("\n")}`;
35478
35523
  throw Error("Invalid canonical form");
35479
35524
  }
35480
35525
  }
35526
+ if (expr.isFunctionExpression && expr.isCanonical) {
35527
+ expr = expr.engine.function(expr.operator, [...expr.ops], {
35528
+ canonical: false,
35529
+ structural: true
35530
+ });
35531
+ }
35481
35532
  return expr;
35482
35533
  }
35483
35534
  function flattenForm(expr) {
@@ -35559,10 +35610,7 @@ ${lines.join("\n")}`;
35559
35610
  if (!expr.ops) return expr;
35560
35611
  const ops = expr.ops.map(multiplyForm);
35561
35612
  if (expr.operator === "Multiply")
35562
- return canonicalMultiply(
35563
- expr.engine,
35564
- ops.map((x) => x.canonical)
35565
- );
35613
+ return canonicalMultiply(expr.engine, ops);
35566
35614
  if (expr.operator === "Negate")
35567
35615
  return canonicalMultiply(expr.engine, [ops[0], expr.engine.NegativeOne]);
35568
35616
  return expr;
@@ -45696,7 +45744,7 @@ Error in definition of "${name}"`,
45696
45744
  return void 0;
45697
45745
  }
45698
45746
  get isCanonical() {
45699
- return this._def !== void 0 && this._def !== null;
45747
+ return this._def !== void 0 && this._def !== null && !this._isStructural;
45700
45748
  }
45701
45749
  get isPure() {
45702
45750
  if (this._isPure !== void 0) return this._isPure;
@@ -45863,7 +45911,7 @@ Error in definition of "${name}"`,
45863
45911
  subs(sub3, options) {
45864
45912
  options ??= { canonical: void 0 };
45865
45913
  if (options.canonical === void 0)
45866
- options = { canonical: this.isCanonical };
45914
+ options = { canonical: this.isCanonical || this.isStructural };
45867
45915
  const ops = this._ops.map((x) => x.subs(sub3, options));
45868
45916
  if (!ops.every((x) => x.isValid))
45869
45917
  return this.engine.function(this._operator, ops, { canonical: false });
@@ -45935,7 +45983,7 @@ Error in definition of "${name}"`,
45935
45983
  return this.numeratorDenominator[1];
45936
45984
  }
45937
45985
  get numeratorDenominator() {
45938
- if (!this.isCanonical) return [this, this.engine.One];
45986
+ if (!(this.isCanonical || this.isStructural)) return [this, this.engine.One];
45939
45987
  if (this.isNumber !== true)
45940
45988
  return [this.engine.Nothing, this.engine.Nothing];
45941
45989
  const operator2 = this.operator;
@@ -45973,11 +46021,11 @@ Error in definition of "${name}"`,
45973
46021
  // ALGEBRAIC OPERATIONS
45974
46022
  //
45975
46023
  neg() {
45976
- if (!this.isCanonical) throw new Error("Not canonical");
46024
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45977
46025
  return negate(this);
45978
46026
  }
45979
46027
  inv() {
45980
- if (!this.isCanonical) throw new Error("Not canonical");
46028
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
45981
46029
  if (this.isOne) return this;
45982
46030
  if (this.isNegativeOne) return this;
45983
46031
  if (this.operator === "Sqrt") return this.op1.inv().sqrt();
@@ -45998,7 +46046,7 @@ Error in definition of "${name}"`,
45998
46046
  return this.engine._fn("Divide", [this.engine.One, this]);
45999
46047
  }
46000
46048
  abs() {
46001
- if (!this.isCanonical) throw new Error("Not canonical");
46049
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46002
46050
  if (this.operator === "Abs" || this.operator === "Negate") return this;
46003
46051
  if (this.isNonNegative) return this;
46004
46052
  if (this.isNonPositive) return this.neg();
@@ -46006,11 +46054,11 @@ Error in definition of "${name}"`,
46006
46054
  }
46007
46055
  add(rhs) {
46008
46056
  if (rhs === 0) return this;
46009
- if (!this.isCanonical) throw new Error("Not canonical");
46057
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46010
46058
  return add3(this, this.engine.box(rhs));
46011
46059
  }
46012
46060
  mul(rhs) {
46013
- if (!this.isCanonical) throw new Error("Not canonical");
46061
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46014
46062
  if (rhs === 0) return this.engine.Zero;
46015
46063
  if (rhs === 1) return this;
46016
46064
  if (rhs === -1) return this.neg();
@@ -46022,14 +46070,14 @@ Error in definition of "${name}"`,
46022
46070
  return mul3(this, this.engine.box(rhs));
46023
46071
  }
46024
46072
  div(rhs) {
46025
- if (!this.isCanonical) throw new Error("Not canonical");
46073
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46026
46074
  return div2(this, rhs);
46027
46075
  }
46028
46076
  pow(exp3) {
46029
46077
  return pow2(this, exp3, { numericApproximation: false });
46030
46078
  }
46031
46079
  root(exp3) {
46032
- if (!this.isCanonical || typeof exp3 !== "number" && !exp3.isCanonical)
46080
+ if (!(this.isCanonical || this.isStructural) || typeof exp3 !== "number" && !(exp3.isCanonical || exp3.isStructural))
46033
46081
  throw new Error("Not canonical");
46034
46082
  const e = typeof exp3 === "number" ? exp3 : exp3.im === 0 ? exp3.re : void 0;
46035
46083
  if (e === 0) return this.engine.NaN;
@@ -46088,7 +46136,7 @@ Error in definition of "${name}"`,
46088
46136
  }
46089
46137
  ln(semiBase) {
46090
46138
  const base = semiBase ? this.engine.box(semiBase) : void 0;
46091
- if (!this.isCanonical) throw new Error("Not canonical");
46139
+ if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46092
46140
  if (this.is(0)) return this.engine.NegativeInfinity;
46093
46141
  if (this.operator === "Exp") {
46094
46142
  if (!base) return this.op1;
@@ -46121,7 +46169,7 @@ Error in definition of "${name}"`,
46121
46169
  return this.engine._fn("Ln", [this]);
46122
46170
  }
46123
46171
  get complexity() {
46124
- if (!this.isCanonical) return void 0;
46172
+ if (!(this.isCanonical || this.isStructural)) return void 0;
46125
46173
  return this.operatorDefinition?.complexity ?? DEFAULT_COMPLEXITY;
46126
46174
  }
46127
46175
  get baseDefinition() {
@@ -51451,6 +51499,13 @@ Error in definition of "${name}"`,
51451
51499
  },
51452
51500
  Exp: "Math.exp",
51453
51501
  Floor: "Math.floor",
51502
+ Fract: ([x], compile) => {
51503
+ if (x === null) throw new Error("Fract: no argument");
51504
+ return BaseCompiler.inlineExpression(
51505
+ "${x} - Math.floor(${x})",
51506
+ compile(x)
51507
+ );
51508
+ },
51454
51509
  Gamma: "_SYS.gamma",
51455
51510
  GCD: "_SYS.gcd",
51456
51511
  Integrate: (args, compile, target) => compileIntegrate(args, compile, target),
@@ -51884,6 +51939,87 @@ Error in definition of "${name}"`,
51884
51939
  Sqrt: "sqrt",
51885
51940
  Step: "step",
51886
51941
  Tan: "tan",
51942
+ // Reciprocal trigonometric functions (no GLSL built-ins)
51943
+ Cot: ([x], compile) => {
51944
+ if (x === null) throw new Error("Cot: no argument");
51945
+ const arg = compile(x);
51946
+ return `(cos(${arg}) / sin(${arg}))`;
51947
+ },
51948
+ Csc: ([x], compile) => {
51949
+ if (x === null) throw new Error("Csc: no argument");
51950
+ return `(1.0 / sin(${compile(x)}))`;
51951
+ },
51952
+ Sec: ([x], compile) => {
51953
+ if (x === null) throw new Error("Sec: no argument");
51954
+ return `(1.0 / cos(${compile(x)}))`;
51955
+ },
51956
+ // Inverse trigonometric (reciprocal)
51957
+ Arccot: ([x], compile) => {
51958
+ if (x === null) throw new Error("Arccot: no argument");
51959
+ return `atan(1.0 / (${compile(x)}))`;
51960
+ },
51961
+ Arccsc: ([x], compile) => {
51962
+ if (x === null) throw new Error("Arccsc: no argument");
51963
+ return `asin(1.0 / (${compile(x)}))`;
51964
+ },
51965
+ Arcsec: ([x], compile) => {
51966
+ if (x === null) throw new Error("Arcsec: no argument");
51967
+ return `acos(1.0 / (${compile(x)}))`;
51968
+ },
51969
+ // Hyperbolic functions (GLSL ES 3.0+ built-ins)
51970
+ Sinh: "sinh",
51971
+ Cosh: "cosh",
51972
+ Tanh: "tanh",
51973
+ // Reciprocal hyperbolic functions
51974
+ Coth: ([x], compile) => {
51975
+ if (x === null) throw new Error("Coth: no argument");
51976
+ const arg = compile(x);
51977
+ return `(cosh(${arg}) / sinh(${arg}))`;
51978
+ },
51979
+ Csch: ([x], compile) => {
51980
+ if (x === null) throw new Error("Csch: no argument");
51981
+ return `(1.0 / sinh(${compile(x)}))`;
51982
+ },
51983
+ Sech: ([x], compile) => {
51984
+ if (x === null) throw new Error("Sech: no argument");
51985
+ return `(1.0 / cosh(${compile(x)}))`;
51986
+ },
51987
+ // Inverse hyperbolic functions (GLSL ES 3.0+ built-ins)
51988
+ Arcosh: "acosh",
51989
+ Arsinh: "asinh",
51990
+ Artanh: "atanh",
51991
+ // Inverse hyperbolic (reciprocal)
51992
+ Arcoth: ([x], compile) => {
51993
+ if (x === null) throw new Error("Arcoth: no argument");
51994
+ return `atanh(1.0 / (${compile(x)}))`;
51995
+ },
51996
+ Arcsch: ([x], compile) => {
51997
+ if (x === null) throw new Error("Arcsch: no argument");
51998
+ return `asinh(1.0 / (${compile(x)}))`;
51999
+ },
52000
+ Arsech: ([x], compile) => {
52001
+ if (x === null) throw new Error("Arsech: no argument");
52002
+ return `acosh(1.0 / (${compile(x)}))`;
52003
+ },
52004
+ // Additional math functions
52005
+ Sgn: "sign",
52006
+ Lb: "log2",
52007
+ Log: (args, compile) => {
52008
+ if (args.length === 0) throw new Error("Log: no argument");
52009
+ if (args.length === 1) return `(log(${compile(args[0])}) / log(10.0))`;
52010
+ return `(log(${compile(args[0])}) / log(${compile(args[1])}))`;
52011
+ },
52012
+ Square: ([x], compile) => {
52013
+ if (x === null) throw new Error("Square: no argument");
52014
+ const arg = compile(x);
52015
+ return `(${arg} * ${arg})`;
52016
+ },
52017
+ Root: ([x, n], compile) => {
52018
+ if (x === null) throw new Error("Root: no argument");
52019
+ if (n === null || n === void 0) return `sqrt(${compile(x)})`;
52020
+ if (n?.re === 2) return `sqrt(${compile(x)})`;
52021
+ return `pow(${compile(x)}, 1.0 / ${compile(n)})`;
52022
+ },
51887
52023
  // Vector/Matrix operations
51888
52024
  Cross: "cross",
51889
52025
  Distance: "distance",
@@ -52430,19 +52566,39 @@ Error in definition of "${name}"`,
52430
52566
  const unwrapped = unwrapOrPropagate(x);
52431
52567
  if (!Array.isArray(unwrapped)) return unwrapped;
52432
52568
  const [xVal] = unwrapped;
52433
- return ok({ lo: Math.floor(xVal.lo), hi: Math.floor(xVal.hi) });
52569
+ const flo = Math.floor(xVal.lo);
52570
+ const fhi = Math.floor(xVal.hi);
52571
+ if (flo === fhi) return ok({ lo: flo, hi: fhi });
52572
+ return { kind: "singular", at: flo + 1 };
52434
52573
  }
52435
52574
  function ceil2(x) {
52436
52575
  const unwrapped = unwrapOrPropagate(x);
52437
52576
  if (!Array.isArray(unwrapped)) return unwrapped;
52438
52577
  const [xVal] = unwrapped;
52439
- return ok({ lo: Math.ceil(xVal.lo), hi: Math.ceil(xVal.hi) });
52578
+ const clo = Math.ceil(xVal.lo);
52579
+ const chi = Math.ceil(xVal.hi);
52580
+ if (clo === chi) return ok({ lo: clo, hi: chi });
52581
+ return { kind: "singular", at: clo };
52440
52582
  }
52441
52583
  function round2(x) {
52442
52584
  const unwrapped = unwrapOrPropagate(x);
52443
52585
  if (!Array.isArray(unwrapped)) return unwrapped;
52444
52586
  const [xVal] = unwrapped;
52445
- return ok({ lo: Math.round(xVal.lo), hi: Math.round(xVal.hi) });
52587
+ const rlo = Math.round(xVal.lo);
52588
+ const rhi = Math.round(xVal.hi);
52589
+ if (rlo === rhi) return ok({ lo: rlo, hi: rhi });
52590
+ return { kind: "singular", at: rlo + 0.5 };
52591
+ }
52592
+ function fract(x) {
52593
+ const unwrapped = unwrapOrPropagate(x);
52594
+ if (!Array.isArray(unwrapped)) return unwrapped;
52595
+ const [xVal] = unwrapped;
52596
+ const flo = Math.floor(xVal.lo);
52597
+ const fhi = Math.floor(xVal.hi);
52598
+ if (flo === fhi) {
52599
+ return ok({ lo: xVal.lo - flo, hi: xVal.hi - flo });
52600
+ }
52601
+ return { kind: "singular", at: flo + 1 };
52446
52602
  }
52447
52603
  function min2(a, b) {
52448
52604
  const unwrapped = unwrapOrPropagate(a, b);
@@ -52469,18 +52625,15 @@ Error in definition of "${name}"`,
52469
52625
  if (containsZero(bVal)) {
52470
52626
  return { kind: "singular" };
52471
52627
  }
52472
- const bAbs = Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi));
52473
- const aWidth = aVal.hi - aVal.lo;
52474
- if (aWidth >= bAbs) {
52475
- return ok({ lo: 0, hi: bAbs });
52476
- }
52477
- const modLo = (aVal.lo % bAbs + bAbs) % bAbs;
52478
- const modHi = (aVal.hi % bAbs + bAbs) % bAbs;
52479
- if (modLo <= modHi) {
52480
- return ok({ lo: modLo, hi: modHi });
52481
- } else {
52482
- return ok({ lo: 0, hi: bAbs });
52628
+ const period = Math.abs(bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi)));
52629
+ const flo = Math.floor(aVal.lo / period);
52630
+ const fhi = Math.floor(aVal.hi / period);
52631
+ if (flo !== fhi) {
52632
+ return { kind: "singular", at: (flo + 1) * period };
52483
52633
  }
52634
+ const modLo = aVal.lo - period * flo;
52635
+ const modHi = aVal.hi - period * flo;
52636
+ return ok({ lo: Math.min(modLo, modHi), hi: Math.max(modLo, modHi) });
52484
52637
  }
52485
52638
  function sign2(x) {
52486
52639
  const unwrapped = unwrapOrPropagate(x);
@@ -52489,9 +52642,7 @@ Error in definition of "${name}"`,
52489
52642
  if (xVal.lo > 0) return ok({ lo: 1, hi: 1 });
52490
52643
  if (xVal.hi < 0) return ok({ lo: -1, hi: -1 });
52491
52644
  if (xVal.lo === 0 && xVal.hi === 0) return ok({ lo: 0, hi: 0 });
52492
- if (xVal.lo < 0 && xVal.hi > 0) return ok({ lo: -1, hi: 1 });
52493
- if (xVal.lo === 0) return ok({ lo: 0, hi: 1 });
52494
- return ok({ lo: -1, hi: 0 });
52645
+ return { kind: "singular", at: 0 };
52495
52646
  }
52496
52647
 
52497
52648
  // src/compute-engine/interval/trigonometric.ts
@@ -52751,6 +52902,81 @@ Error in definition of "${name}"`,
52751
52902
  }
52752
52903
  return ok({ lo: Math.atanh(xVal.lo), hi: Math.atanh(xVal.hi) });
52753
52904
  }
52905
+ function acot(x) {
52906
+ const unwrapped = unwrapOrPropagate(x);
52907
+ if (!Array.isArray(unwrapped)) return unwrapped;
52908
+ const [xVal] = unwrapped;
52909
+ if (containsZero(xVal)) {
52910
+ return { kind: "singular", at: 0 };
52911
+ }
52912
+ return atan3(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52913
+ }
52914
+ function acsc(x) {
52915
+ const unwrapped = unwrapOrPropagate(x);
52916
+ if (!Array.isArray(unwrapped)) return unwrapped;
52917
+ const [xVal] = unwrapped;
52918
+ if (containsZero(xVal)) {
52919
+ return { kind: "singular", at: 0 };
52920
+ }
52921
+ return asin2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52922
+ }
52923
+ function asec(x) {
52924
+ const unwrapped = unwrapOrPropagate(x);
52925
+ if (!Array.isArray(unwrapped)) return unwrapped;
52926
+ const [xVal] = unwrapped;
52927
+ if (containsZero(xVal)) {
52928
+ return { kind: "singular", at: 0 };
52929
+ }
52930
+ return acos2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52931
+ }
52932
+ function coth(x) {
52933
+ const unwrapped = unwrapOrPropagate(x);
52934
+ if (!Array.isArray(unwrapped)) return unwrapped;
52935
+ const [xVal] = unwrapped;
52936
+ if (containsZero(xVal)) {
52937
+ return { kind: "singular", at: 0 };
52938
+ }
52939
+ return div3(cosh3(xVal), sinh3(xVal));
52940
+ }
52941
+ function csch(x) {
52942
+ const unwrapped = unwrapOrPropagate(x);
52943
+ if (!Array.isArray(unwrapped)) return unwrapped;
52944
+ const [xVal] = unwrapped;
52945
+ if (containsZero(xVal)) {
52946
+ return { kind: "singular", at: 0 };
52947
+ }
52948
+ return div3(ok({ lo: 1, hi: 1 }), sinh3(xVal));
52949
+ }
52950
+ function sech(x) {
52951
+ return div3(ok({ lo: 1, hi: 1 }), cosh3(x));
52952
+ }
52953
+ function acoth(x) {
52954
+ const unwrapped = unwrapOrPropagate(x);
52955
+ if (!Array.isArray(unwrapped)) return unwrapped;
52956
+ const [xVal] = unwrapped;
52957
+ if (containsZero(xVal)) {
52958
+ return { kind: "singular", at: 0 };
52959
+ }
52960
+ return atanh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52961
+ }
52962
+ function acsch(x) {
52963
+ const unwrapped = unwrapOrPropagate(x);
52964
+ if (!Array.isArray(unwrapped)) return unwrapped;
52965
+ const [xVal] = unwrapped;
52966
+ if (containsZero(xVal)) {
52967
+ return { kind: "singular", at: 0 };
52968
+ }
52969
+ return asinh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52970
+ }
52971
+ function asech(x) {
52972
+ const unwrapped = unwrapOrPropagate(x);
52973
+ if (!Array.isArray(unwrapped)) return unwrapped;
52974
+ const [xVal] = unwrapped;
52975
+ if (containsZero(xVal)) {
52976
+ return { kind: "singular", at: 0 };
52977
+ }
52978
+ return acosh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
52979
+ }
52754
52980
 
52755
52981
  // src/compute-engine/interval/comparison.ts
52756
52982
  function less(a, b) {
@@ -52898,6 +53124,7 @@ Error in definition of "${name}"`,
52898
53124
  floor: floor2,
52899
53125
  ceil: ceil2,
52900
53126
  round: round2,
53127
+ fract,
52901
53128
  min: min2,
52902
53129
  max: max2,
52903
53130
  mod: mod2,
@@ -52919,6 +53146,15 @@ Error in definition of "${name}"`,
52919
53146
  asinh: asinh2,
52920
53147
  acosh: acosh2,
52921
53148
  atanh: atanh2,
53149
+ acot,
53150
+ acsc,
53151
+ asec,
53152
+ coth,
53153
+ csch,
53154
+ sech,
53155
+ acoth,
53156
+ acsch,
53157
+ asech,
52922
53158
  // Comparison
52923
53159
  less,
52924
53160
  lessEqual,
@@ -53063,17 +53299,28 @@ Error in definition of "${name}"`,
53063
53299
  Arcsin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53064
53300
  Arccos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53065
53301
  Arctan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53302
+ Arccot: (args, compile) => `_IA.acot(${compile(args[0])})`,
53303
+ Arccsc: (args, compile) => `_IA.acsc(${compile(args[0])})`,
53304
+ Arcsec: (args, compile) => `_IA.asec(${compile(args[0])})`,
53066
53305
  // Hyperbolic functions
53067
53306
  Sinh: (args, compile) => `_IA.sinh(${compile(args[0])})`,
53068
53307
  Cosh: (args, compile) => `_IA.cosh(${compile(args[0])})`,
53069
53308
  Tanh: (args, compile) => `_IA.tanh(${compile(args[0])})`,
53309
+ Coth: (args, compile) => `_IA.coth(${compile(args[0])})`,
53310
+ Csch: (args, compile) => `_IA.csch(${compile(args[0])})`,
53311
+ Sech: (args, compile) => `_IA.sech(${compile(args[0])})`,
53070
53312
  Arsinh: (args, compile) => `_IA.asinh(${compile(args[0])})`,
53071
53313
  Arcosh: (args, compile) => `_IA.acosh(${compile(args[0])})`,
53072
53314
  Artanh: (args, compile) => `_IA.atanh(${compile(args[0])})`,
53315
+ Arcoth: (args, compile) => `_IA.acoth(${compile(args[0])})`,
53316
+ Arcsch: (args, compile) => `_IA.acsch(${compile(args[0])})`,
53317
+ Arsech: (args, compile) => `_IA.asech(${compile(args[0])})`,
53073
53318
  // Inverse trig (alternative names)
53074
53319
  Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53075
53320
  Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53076
53321
  Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53322
+ // Elementary
53323
+ Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
53077
53324
  // Mod
53078
53325
  Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
53079
53326
  // Conditionals
@@ -53396,24 +53643,94 @@ IntervalResult ia_abs(vec2 x) {
53396
53643
  return ia_ok(vec2(0.0, max(-x.x, x.y)));
53397
53644
  }
53398
53645
 
53399
- // Sign function
53646
+ // Sign function - has jump discontinuity at 0
53400
53647
  IntervalResult ia_sign(vec2 x) {
53401
53648
  if (x.x > 0.0) return ia_ok(vec2(1.0, 1.0));
53402
53649
  if (x.y < 0.0) return ia_ok(vec2(-1.0, -1.0));
53403
53650
  if (x.x == 0.0 && x.y == 0.0) return ia_ok(vec2(0.0, 0.0));
53404
- if (x.x < 0.0 && x.y > 0.0) return ia_ok(vec2(-1.0, 1.0));
53405
- if (x.x == 0.0) return ia_ok(vec2(0.0, 1.0));
53406
- return ia_ok(vec2(-1.0, 0.0));
53651
+ // Interval spans 0 - discontinuity
53652
+ return ia_singular(0.0);
53407
53653
  }
53408
53654
 
53409
- // Floor
53655
+ // Floor - has jump discontinuities at every integer
53410
53656
  IntervalResult ia_floor(vec2 x) {
53411
- return ia_ok(vec2(floor(x.x), floor(x.y)));
53657
+ float flo = floor(x.x);
53658
+ float fhi = floor(x.y);
53659
+ if (flo == fhi) {
53660
+ return ia_ok(vec2(flo, fhi));
53661
+ }
53662
+ // Interval spans an integer boundary - discontinuity at first integer > x.x
53663
+ return ia_singular(flo + 1.0);
53412
53664
  }
53413
53665
 
53414
- // Ceiling
53666
+ // Ceiling - has jump discontinuities at every integer
53415
53667
  IntervalResult ia_ceil(vec2 x) {
53416
- return ia_ok(vec2(ceil(x.x), ceil(x.y)));
53668
+ float clo = ceil(x.x);
53669
+ float chi = ceil(x.y);
53670
+ if (clo == chi) {
53671
+ return ia_ok(vec2(clo, chi));
53672
+ }
53673
+ // Interval spans an integer boundary - discontinuity at ceil(x.x)
53674
+ return ia_singular(clo);
53675
+ }
53676
+
53677
+ // Round - has jump discontinuities at every half-integer
53678
+ // Note: GLSL round() uses IEEE 754 round-half-to-even, while JS Math.round
53679
+ // uses round-half-up. They differ only AT half-integers; discontinuity
53680
+ // detection is safe because intervals spanning half-integers return singular.
53681
+ IntervalResult ia_round(vec2 x) {
53682
+ float rlo = round(x.x);
53683
+ float rhi = round(x.y);
53684
+ if (rlo == rhi) {
53685
+ return ia_ok(vec2(rlo, rhi));
53686
+ }
53687
+ // Interval spans a half-integer boundary - discontinuity
53688
+ return ia_singular(rlo + 0.5);
53689
+ }
53690
+
53691
+ // Fract - sawtooth discontinuities at every integer
53692
+ // fract(x) = x - floor(x), jumps from ~1 back to 0 at each integer
53693
+ IntervalResult ia_fract(vec2 x) {
53694
+ float flo = floor(x.x);
53695
+ float fhi = floor(x.y);
53696
+ if (flo == fhi) {
53697
+ // No integer crossing - fract is continuous (linear) on this interval
53698
+ return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
53699
+ }
53700
+ // Interval spans an integer - sawtooth discontinuity
53701
+ return ia_singular(flo + 1.0);
53702
+ }
53703
+
53704
+ // Mod - periodic discontinuities at multiples of the modulus
53705
+ // mod(x, y) = x - y * floor(x / y)
53706
+ IntervalResult ia_mod(vec2 x, vec2 y) {
53707
+ // y contains zero - undefined
53708
+ if (y.x <= 0.0 && y.y >= 0.0) {
53709
+ return ia_singular(0.0);
53710
+ }
53711
+
53712
+ // Constant modulus (point interval) - common case
53713
+ if (y.x == y.y) {
53714
+ float period = abs(y.x);
53715
+ float flo = floor(x.x / period);
53716
+ float fhi = floor(x.y / period);
53717
+ if (flo == fhi) {
53718
+ // No discontinuity - mod is continuous (linear) on this interval
53719
+ float mlo = x.x - period * flo;
53720
+ float mhi = x.y - period * flo;
53721
+ return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
53722
+ }
53723
+ // Discontinuity at first multiple of period in the interval
53724
+ return ia_singular((flo + 1.0) * period);
53725
+ }
53726
+
53727
+ // General case: compose from existing operations
53728
+ // Discontinuity detection comes from ia_floor
53729
+ IntervalResult q = ia_div(x, y);
53730
+ if (ia_is_error(q.status)) return q;
53731
+ IntervalResult fq = ia_floor(q.value);
53732
+ if (ia_is_error(fq.status)) return fq;
53733
+ return ia_sub(x, ia_mul_raw(y, fq.value));
53417
53734
  }
53418
53735
 
53419
53736
  // Min of two intervals
@@ -53702,6 +54019,32 @@ IntervalResult ia_ceil(IntervalResult x) {
53702
54019
  return ia_ceil(x.value);
53703
54020
  }
53704
54021
 
54022
+ IntervalResult ia_round(IntervalResult x) {
54023
+ if (ia_is_error(x.status)) return x;
54024
+ return ia_round(x.value);
54025
+ }
54026
+
54027
+ IntervalResult ia_fract(IntervalResult x) {
54028
+ if (ia_is_error(x.status)) return x;
54029
+ return ia_fract(x.value);
54030
+ }
54031
+
54032
+ IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
54033
+ if (ia_is_error(a.status)) return a;
54034
+ if (ia_is_error(b.status)) return b;
54035
+ return ia_mod(a.value, b.value);
54036
+ }
54037
+
54038
+ IntervalResult ia_mod(IntervalResult a, vec2 b) {
54039
+ if (ia_is_error(a.status)) return a;
54040
+ return ia_mod(a.value, b);
54041
+ }
54042
+
54043
+ IntervalResult ia_mod(vec2 a, IntervalResult b) {
54044
+ if (ia_is_error(b.status)) return b;
54045
+ return ia_mod(a, b.value);
54046
+ }
54047
+
53705
54048
  IntervalResult ia_min(IntervalResult a, IntervalResult b) {
53706
54049
  if (ia_is_error(a.status)) return a;
53707
54050
  if (ia_is_error(b.status)) return b;
@@ -53783,6 +54126,263 @@ IntervalResult ia_tanh(IntervalResult x) {
53783
54126
  if (ia_is_error(x.status)) return x;
53784
54127
  return ia_tanh(x.value);
53785
54128
  }
54129
+
54130
+ // Cotangent (derived from cos/sin)
54131
+ IntervalResult ia_cot(vec2 x) {
54132
+ return ia_div(ia_cos(x), ia_sin(x));
54133
+ }
54134
+
54135
+ IntervalResult ia_cot(IntervalResult x) {
54136
+ if (ia_is_error(x.status)) return x;
54137
+ return ia_cot(x.value);
54138
+ }
54139
+
54140
+ // Cosecant (derived from 1/sin)
54141
+ IntervalResult ia_csc(vec2 x) {
54142
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sin(x));
54143
+ }
54144
+
54145
+ IntervalResult ia_csc(IntervalResult x) {
54146
+ if (ia_is_error(x.status)) return x;
54147
+ return ia_csc(x.value);
54148
+ }
54149
+
54150
+ // Secant (derived from 1/cos)
54151
+ IntervalResult ia_sec(vec2 x) {
54152
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cos(x));
54153
+ }
54154
+
54155
+ IntervalResult ia_sec(IntervalResult x) {
54156
+ if (ia_is_error(x.status)) return x;
54157
+ return ia_sec(x.value);
54158
+ }
54159
+
54160
+ // Inverse cotangent
54161
+ IntervalResult ia_acot(vec2 x) {
54162
+ return ia_atan(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54163
+ }
54164
+
54165
+ IntervalResult ia_acot(IntervalResult x) {
54166
+ if (ia_is_error(x.status)) return x;
54167
+ return ia_acot(x.value);
54168
+ }
54169
+
54170
+ // Inverse cosecant
54171
+ IntervalResult ia_acsc(vec2 x) {
54172
+ return ia_asin(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54173
+ }
54174
+
54175
+ IntervalResult ia_acsc(IntervalResult x) {
54176
+ if (ia_is_error(x.status)) return x;
54177
+ return ia_acsc(x.value);
54178
+ }
54179
+
54180
+ // Inverse secant
54181
+ IntervalResult ia_asec(vec2 x) {
54182
+ return ia_acos(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54183
+ }
54184
+
54185
+ IntervalResult ia_asec(IntervalResult x) {
54186
+ if (ia_is_error(x.status)) return x;
54187
+ return ia_asec(x.value);
54188
+ }
54189
+
54190
+ // Hyperbolic cotangent
54191
+ IntervalResult ia_coth(vec2 x) {
54192
+ return ia_div(ia_cosh(x), ia_sinh(x));
54193
+ }
54194
+
54195
+ IntervalResult ia_coth(IntervalResult x) {
54196
+ if (ia_is_error(x.status)) return x;
54197
+ return ia_coth(x.value);
54198
+ }
54199
+
54200
+ // Hyperbolic cosecant
54201
+ IntervalResult ia_csch(vec2 x) {
54202
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sinh(x));
54203
+ }
54204
+
54205
+ IntervalResult ia_csch(IntervalResult x) {
54206
+ if (ia_is_error(x.status)) return x;
54207
+ return ia_csch(x.value);
54208
+ }
54209
+
54210
+ // Hyperbolic secant
54211
+ IntervalResult ia_sech(vec2 x) {
54212
+ return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cosh(x));
54213
+ }
54214
+
54215
+ IntervalResult ia_sech(IntervalResult x) {
54216
+ if (ia_is_error(x.status)) return x;
54217
+ return ia_sech(x.value);
54218
+ }
54219
+
54220
+ // Inverse hyperbolic sine
54221
+ IntervalResult ia_asinh(vec2 x) {
54222
+ return ia_ok(vec2(asinh(x.x) - IA_EPS, asinh(x.y) + IA_EPS));
54223
+ }
54224
+
54225
+ IntervalResult ia_asinh(IntervalResult x) {
54226
+ if (ia_is_error(x.status)) return x;
54227
+ return ia_asinh(x.value);
54228
+ }
54229
+
54230
+ // Inverse hyperbolic cosine
54231
+ IntervalResult ia_acosh(vec2 x) {
54232
+ if (x.y < 1.0) {
54233
+ return ia_empty();
54234
+ }
54235
+ if (x.x >= 1.0) {
54236
+ return ia_ok(vec2(acosh(x.x) - IA_EPS, acosh(x.y) + IA_EPS));
54237
+ }
54238
+ return ia_partial(vec2(0.0, acosh(x.y) + IA_EPS), IA_PARTIAL_LO);
54239
+ }
54240
+
54241
+ IntervalResult ia_acosh(IntervalResult x) {
54242
+ if (ia_is_error(x.status)) return x;
54243
+ return ia_acosh(x.value);
54244
+ }
54245
+
54246
+ // Inverse hyperbolic tangent
54247
+ IntervalResult ia_atanh(vec2 x) {
54248
+ if (x.x >= 1.0 || x.y <= -1.0) {
54249
+ return ia_empty();
54250
+ }
54251
+ vec2 clipped = vec2(max(x.x, -1.0 + IA_EPS), min(x.y, 1.0 - IA_EPS));
54252
+ if (x.x < -1.0 || x.y > 1.0) {
54253
+ float clip = (x.x < -1.0 && x.y > 1.0) ? IA_PARTIAL_BOTH :
54254
+ (x.x < -1.0) ? IA_PARTIAL_LO : IA_PARTIAL_HI;
54255
+ return ia_partial(vec2(atanh(clipped.x) - IA_EPS, atanh(clipped.y) + IA_EPS), clip);
54256
+ }
54257
+ return ia_ok(vec2(atanh(x.x) - IA_EPS, atanh(x.y) + IA_EPS));
54258
+ }
54259
+
54260
+ IntervalResult ia_atanh(IntervalResult x) {
54261
+ if (ia_is_error(x.status)) return x;
54262
+ return ia_atanh(x.value);
54263
+ }
54264
+
54265
+ // Inverse hyperbolic cotangent
54266
+ IntervalResult ia_acoth(vec2 x) {
54267
+ return ia_atanh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54268
+ }
54269
+
54270
+ IntervalResult ia_acoth(IntervalResult x) {
54271
+ if (ia_is_error(x.status)) return x;
54272
+ return ia_acoth(x.value);
54273
+ }
54274
+
54275
+ // Inverse hyperbolic cosecant
54276
+ IntervalResult ia_acsch(vec2 x) {
54277
+ return ia_asinh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54278
+ }
54279
+
54280
+ IntervalResult ia_acsch(IntervalResult x) {
54281
+ if (ia_is_error(x.status)) return x;
54282
+ return ia_acsch(x.value);
54283
+ }
54284
+
54285
+ // Inverse hyperbolic secant
54286
+ IntervalResult ia_asech(vec2 x) {
54287
+ return ia_acosh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
54288
+ }
54289
+
54290
+ IntervalResult ia_asech(IntervalResult x) {
54291
+ if (ia_is_error(x.status)) return x;
54292
+ return ia_asech(x.value);
54293
+ }
54294
+
54295
+ // Boolean interval comparisons
54296
+ // Returns 1.0 = true, 0.0 = false, 0.5 = maybe
54297
+ const float IA_TRUE = 1.0;
54298
+ const float IA_FALSE = 0.0;
54299
+ const float IA_MAYBE = 0.5;
54300
+
54301
+ float ia_less(vec2 a, vec2 b) {
54302
+ if (a.y < b.x) return IA_TRUE;
54303
+ if (a.x >= b.y) return IA_FALSE;
54304
+ return IA_MAYBE;
54305
+ }
54306
+
54307
+ float ia_lessEqual(vec2 a, vec2 b) {
54308
+ if (a.y <= b.x) return IA_TRUE;
54309
+ if (a.x > b.y) return IA_FALSE;
54310
+ return IA_MAYBE;
54311
+ }
54312
+
54313
+ float ia_greater(vec2 a, vec2 b) {
54314
+ if (a.x > b.y) return IA_TRUE;
54315
+ if (a.y <= b.x) return IA_FALSE;
54316
+ return IA_MAYBE;
54317
+ }
54318
+
54319
+ float ia_greaterEqual(vec2 a, vec2 b) {
54320
+ if (a.x >= b.y) return IA_TRUE;
54321
+ if (a.y < b.x) return IA_FALSE;
54322
+ return IA_MAYBE;
54323
+ }
54324
+
54325
+ float ia_equal(vec2 a, vec2 b) {
54326
+ if (a.x == a.y && b.x == b.y && a.x == b.x) return IA_TRUE;
54327
+ if (a.y < b.x || b.y < a.x) return IA_FALSE;
54328
+ return IA_MAYBE;
54329
+ }
54330
+
54331
+ float ia_notEqual(vec2 a, vec2 b) {
54332
+ float eq = ia_equal(a, b);
54333
+ if (eq == IA_TRUE) return IA_FALSE;
54334
+ if (eq == IA_FALSE) return IA_TRUE;
54335
+ return IA_MAYBE;
54336
+ }
54337
+
54338
+ float ia_and(float a, float b) {
54339
+ if (a == IA_FALSE || b == IA_FALSE) return IA_FALSE;
54340
+ if (a == IA_TRUE && b == IA_TRUE) return IA_TRUE;
54341
+ return IA_MAYBE;
54342
+ }
54343
+
54344
+ float ia_or(float a, float b) {
54345
+ if (a == IA_TRUE || b == IA_TRUE) return IA_TRUE;
54346
+ if (a == IA_FALSE && b == IA_FALSE) return IA_FALSE;
54347
+ return IA_MAYBE;
54348
+ }
54349
+
54350
+ float ia_not(float a) {
54351
+ if (a == IA_TRUE) return IA_FALSE;
54352
+ if (a == IA_FALSE) return IA_TRUE;
54353
+ return IA_MAYBE;
54354
+ }
54355
+
54356
+ // IntervalResult overloads for comparisons
54357
+ float ia_less(IntervalResult a, IntervalResult b) {
54358
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54359
+ return ia_less(a.value, b.value);
54360
+ }
54361
+
54362
+ float ia_lessEqual(IntervalResult a, IntervalResult b) {
54363
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54364
+ return ia_lessEqual(a.value, b.value);
54365
+ }
54366
+
54367
+ float ia_greater(IntervalResult a, IntervalResult b) {
54368
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54369
+ return ia_greater(a.value, b.value);
54370
+ }
54371
+
54372
+ float ia_greaterEqual(IntervalResult a, IntervalResult b) {
54373
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54374
+ return ia_greaterEqual(a.value, b.value);
54375
+ }
54376
+
54377
+ float ia_equal(IntervalResult a, IntervalResult b) {
54378
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54379
+ return ia_equal(a.value, b.value);
54380
+ }
54381
+
54382
+ float ia_notEqual(IntervalResult a, IntervalResult b) {
54383
+ if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
54384
+ return ia_notEqual(a.value, b.value);
54385
+ }
53786
54386
  `;
53787
54387
  var INTERVAL_GLSL_OPERATORS = {
53788
54388
  Add: ["ia_add", 20],
@@ -53834,7 +54434,9 @@ IntervalResult ia_tanh(IntervalResult x) {
53834
54434
  Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
53835
54435
  Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
53836
54436
  Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
54437
+ Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
53837
54438
  Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
54439
+ Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
53838
54440
  Max: (args, compile) => {
53839
54441
  if (args.length === 0) return "ia_point(-1e38)";
53840
54442
  if (args.length === 1) return compile(args[0]);
@@ -53867,6 +54469,7 @@ IntervalResult ia_tanh(IntervalResult x) {
53867
54469
  }
53868
54470
  throw new Error("Interval GLSL does not support variable exponents");
53869
54471
  },
54472
+ Round: (args, compile) => `ia_round(${compile(args[0])})`,
53870
54473
  Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
53871
54474
  Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
53872
54475
  Square: (args, compile) => `ia_square(${compile(args[0])})`,
@@ -53877,10 +54480,40 @@ IntervalResult ia_tanh(IntervalResult x) {
53877
54480
  Arcsin: (args, compile) => `ia_asin(${compile(args[0])})`,
53878
54481
  Arccos: (args, compile) => `ia_acos(${compile(args[0])})`,
53879
54482
  Arctan: (args, compile) => `ia_atan(${compile(args[0])})`,
54483
+ // Reciprocal trigonometric functions
54484
+ Cot: (args, compile) => `ia_cot(${compile(args[0])})`,
54485
+ Csc: (args, compile) => `ia_csc(${compile(args[0])})`,
54486
+ Sec: (args, compile) => `ia_sec(${compile(args[0])})`,
54487
+ // Inverse trigonometric (reciprocal)
54488
+ Arccot: (args, compile) => `ia_acot(${compile(args[0])})`,
54489
+ Arccsc: (args, compile) => `ia_acsc(${compile(args[0])})`,
54490
+ Arcsec: (args, compile) => `ia_asec(${compile(args[0])})`,
53880
54491
  // Hyperbolic functions
53881
54492
  Sinh: (args, compile) => `ia_sinh(${compile(args[0])})`,
53882
54493
  Cosh: (args, compile) => `ia_cosh(${compile(args[0])})`,
53883
- Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`
54494
+ Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`,
54495
+ // Reciprocal hyperbolic functions
54496
+ Coth: (args, compile) => `ia_coth(${compile(args[0])})`,
54497
+ Csch: (args, compile) => `ia_csch(${compile(args[0])})`,
54498
+ Sech: (args, compile) => `ia_sech(${compile(args[0])})`,
54499
+ // Inverse hyperbolic functions
54500
+ Arsinh: (args, compile) => `ia_asinh(${compile(args[0])})`,
54501
+ Arcosh: (args, compile) => `ia_acosh(${compile(args[0])})`,
54502
+ Artanh: (args, compile) => `ia_atanh(${compile(args[0])})`,
54503
+ // Inverse hyperbolic (reciprocal)
54504
+ Arcoth: (args, compile) => `ia_acoth(${compile(args[0])})`,
54505
+ Arcsch: (args, compile) => `ia_acsch(${compile(args[0])})`,
54506
+ Arsech: (args, compile) => `ia_asech(${compile(args[0])})`,
54507
+ // Comparison and logic (return float: 1.0=true, 0.0=false, 0.5=maybe)
54508
+ Equal: (args, compile) => `ia_equal(${compile(args[0])}, ${compile(args[1])})`,
54509
+ NotEqual: (args, compile) => `ia_notEqual(${compile(args[0])}, ${compile(args[1])})`,
54510
+ Less: (args, compile) => `ia_less(${compile(args[0])}, ${compile(args[1])})`,
54511
+ LessEqual: (args, compile) => `ia_lessEqual(${compile(args[0])}, ${compile(args[1])})`,
54512
+ Greater: (args, compile) => `ia_greater(${compile(args[0])}, ${compile(args[1])})`,
54513
+ GreaterEqual: (args, compile) => `ia_greaterEqual(${compile(args[0])}, ${compile(args[1])})`,
54514
+ And: (args, compile) => `ia_and(${compile(args[0])}, ${compile(args[1])})`,
54515
+ Or: (args, compile) => `ia_or(${compile(args[0])}, ${compile(args[1])})`,
54516
+ Not: (args, compile) => `ia_not(${compile(args[0])})`
53884
54517
  };
53885
54518
  var IntervalGLSLTarget = class {
53886
54519
  getOperators() {
@@ -54708,12 +55341,11 @@ IntervalResult ${functionName}(${params}) {
54708
55341
  bignum
54709
55342
  );
54710
55343
  if (value instanceof Decimal) {
54711
- if (value.isInteger() && value.e <= MAX_BIGINT_DIGITS)
54712
- return new ExactNumericValue(
54713
- bigint(value.toString()),
54714
- makeNumericValue,
54715
- bignum
54716
- );
55344
+ if (value.isInteger() && value.e <= MAX_BIGINT_DIGITS) {
55345
+ const n = bigint(value.toString());
55346
+ if (n !== null)
55347
+ return new ExactNumericValue(n, makeNumericValue, bignum);
55348
+ }
54717
55349
  return makeNumericValue(value);
54718
55350
  }
54719
55351
  if (value instanceof Complex) {
@@ -55779,10 +56411,10 @@ IntervalResult ${functionName}(${params}) {
55779
56411
  // src/compute-engine.ts
55780
56412
  init_types6();
55781
56413
  init_base_compiler();
55782
- var version = "0.35.1";
56414
+ var version = "0.35.3";
55783
56415
  globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
55784
56416
  ComputeEngine: ComputeEngine.prototype.constructor,
55785
- version: "0.35.1"
56417
+ version: "0.35.3"
55786
56418
  };
55787
56419
  return __toCommonJS(compute_engine_exports);
55788
56420
  })();