@cortex-js/compute-engine 0.35.4 → 0.35.6

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 +248 -56
  2. package/dist/compute-engine.min.esm.js +111 -42
  3. package/dist/compute-engine.min.umd.js +111 -42
  4. package/dist/compute-engine.umd.js +248 -56
  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 +3 -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 +18 -1
  85. package/dist/types/compute-engine/interval/index.d.ts +5 -3
  86. package/dist/types/compute-engine/interval/trigonometric.d.ts +1 -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 +3 -2
@@ -1,4 +1,4 @@
1
- /** Compute Engine 0.35.4 */
1
+ /** Compute Engine 0.35.6 */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -15097,22 +15097,22 @@ function polynomialDivide(dividend, divisor, variable) {
15097
15097
  if (dividendDeg < divisorDeg) {
15098
15098
  return [ce.Zero, dividend];
15099
15099
  }
15100
- const remainder = dividendCoeffs.map((c) => c);
15100
+ const remainder2 = dividendCoeffs.map((c) => c);
15101
15101
  const quotientCoeffs = new Array(
15102
15102
  dividendDeg - divisorDeg + 1
15103
15103
  ).fill(ce.Zero);
15104
15104
  const leadingDivisor = divisorCoeffs[divisorDeg];
15105
15105
  for (let i = dividendDeg; i >= divisorDeg; i--) {
15106
- if (remainder[i].is(0)) continue;
15107
- const quotientCoef = remainder[i].div(leadingDivisor);
15106
+ if (remainder2[i].is(0)) continue;
15107
+ const quotientCoef = remainder2[i].div(leadingDivisor);
15108
15108
  quotientCoeffs[i - divisorDeg] = quotientCoef;
15109
15109
  for (let j = 0; j <= divisorDeg; j++) {
15110
15110
  const product = quotientCoef.mul(divisorCoeffs[j]);
15111
- remainder[i - divisorDeg + j] = remainder[i - divisorDeg + j].sub(product);
15111
+ remainder2[i - divisorDeg + j] = remainder2[i - divisorDeg + j].sub(product);
15112
15112
  }
15113
15113
  }
15114
15114
  const quotient = fromCoefficients(quotientCoeffs, variable);
15115
- const remainderPoly = fromCoefficients(remainder, variable);
15115
+ const remainderPoly = fromCoefficients(remainder2, variable);
15116
15116
  return [quotient, remainderPoly];
15117
15117
  }
15118
15118
  function polynomialGCD(a, b, variable) {
@@ -15139,9 +15139,9 @@ function polynomialGCD(a, b, variable) {
15139
15139
  if (!divResult) {
15140
15140
  return ce.One;
15141
15141
  }
15142
- const [, remainder] = divResult;
15142
+ const [, remainder2] = divResult;
15143
15143
  p = q;
15144
- q = remainder;
15144
+ q = remainder2;
15145
15145
  }
15146
15146
  return makeMonic(p, variable);
15147
15147
  }
@@ -20812,6 +20812,7 @@ var init_abstract_boxed_expression = __esm({
20812
20812
  });
20813
20813
  } catch (e) {
20814
20814
  if (options?.fallback ?? true) {
20815
+ console.warn(`Compilation fallback for "${this.operator}": ${e.message}`);
20815
20816
  const { applicableN1: applicableN12 } = (init_function_utils(), __toCommonJS(function_utils_exports));
20816
20817
  return applicableN12(this);
20817
20818
  }
@@ -23824,7 +23825,8 @@ function typeCouldBeCollection(type2) {
23824
23825
  }
23825
23826
  if (type2.kind === "list" || type2.kind === "set" || type2.kind === "tuple")
23826
23827
  return true;
23827
- if (type2.kind === "union") return type2.types.some((t) => typeCouldBeCollection(t));
23828
+ if (type2.kind === "union")
23829
+ return type2.types.some((t) => typeCouldBeCollection(t));
23828
23830
  return false;
23829
23831
  }
23830
23832
  function typeCouldBeNumericCollection(type2) {
@@ -24632,6 +24634,16 @@ var init_arithmetic = __esm({
24632
24634
  return engine.function("Power", [engine.E, ...args]);
24633
24635
  }
24634
24636
  },
24637
+ Exp2: {
24638
+ description: "Base-2 exponential: 2^x",
24639
+ complexity: 3500,
24640
+ broadcastable: true,
24641
+ signature: "(number) -> number",
24642
+ canonical: (args, { engine }) => {
24643
+ args = checkNumericArgs(engine, args, 1);
24644
+ return engine.function("Power", [engine.number(2), ...args]);
24645
+ }
24646
+ },
24635
24647
  Factorial: {
24636
24648
  description: "Factorial function: the product of all positive integers less than or equal to n",
24637
24649
  wikidata: "Q120976",
@@ -24721,6 +24733,22 @@ var init_arithmetic = __esm({
24721
24733
  (z) => z.floor(0)
24722
24734
  )
24723
24735
  },
24736
+ Fract: {
24737
+ description: "Fractional part of a number: x - floor(x)",
24738
+ complexity: 1250,
24739
+ broadcastable: true,
24740
+ signature: "(number) -> number",
24741
+ sgn: ([x]) => {
24742
+ if (x.isNonNegative) return "non-negative";
24743
+ return void 0;
24744
+ },
24745
+ evaluate: ([x]) => apply(
24746
+ x,
24747
+ (x2) => x2 - Math.floor(x2),
24748
+ (x2) => x2.sub(x2.floor()),
24749
+ (z) => z.sub(z.floor(0))
24750
+ )
24751
+ },
24724
24752
  Gamma: {
24725
24753
  wikidata: "Q190573",
24726
24754
  complexity: 8e3,
@@ -24936,6 +24964,22 @@ var init_arithmetic = __esm({
24936
24964
  sgn: ([x]) => lnSign(x),
24937
24965
  canonical: ([x], { engine }) => engine._fn("Log", [x])
24938
24966
  },
24967
+ Log10: {
24968
+ description: "Base-10 Logarithm",
24969
+ complexity: 4100,
24970
+ broadcastable: true,
24971
+ signature: "(number) -> number",
24972
+ sgn: ([x]) => lnSign(x),
24973
+ canonical: ([x], { engine }) => engine._fn("Log", [x])
24974
+ },
24975
+ Log2: {
24976
+ description: "Base-2 Logarithm",
24977
+ complexity: 4100,
24978
+ broadcastable: true,
24979
+ signature: "(number) -> number",
24980
+ sgn: ([x]) => lnSign(x),
24981
+ canonical: ([x], { engine }) => engine._fn("Log", [x, engine.number(2)])
24982
+ },
24939
24983
  Mod: {
24940
24984
  description: "Modulo",
24941
24985
  wikidata: "Q1799665",
@@ -25178,6 +25222,18 @@ var init_arithmetic = __esm({
25178
25222
  },
25179
25223
  evaluate: ([x, n], { numericApproximation }) => root(x, n, { numericApproximation })
25180
25224
  },
25225
+ Remainder: {
25226
+ description: "IEEE remainder: the signed remainder after dividing x by y, with the quotient rounded to the nearest integer",
25227
+ complexity: 2500,
25228
+ broadcastable: true,
25229
+ signature: "(number, number) -> number",
25230
+ evaluate: ([a, b]) => apply2(
25231
+ a,
25232
+ b,
25233
+ (a2, b2) => a2 - b2 * Math.round(a2 / b2),
25234
+ (a2, b2) => a2.sub(b2.mul(a2.div(b2).round()))
25235
+ )
25236
+ },
25181
25237
  Round: {
25182
25238
  complexity: 1250,
25183
25239
  broadcastable: true,
@@ -25309,6 +25365,19 @@ var init_arithmetic = __esm({
25309
25365
  const rest = args.slice(1);
25310
25366
  return canonicalAdd(engine, [first, ...rest.map((x) => x.neg())]);
25311
25367
  }
25368
+ },
25369
+ Truncate: {
25370
+ description: "Rounds a number towards zero (removes the fractional part)",
25371
+ complexity: 1250,
25372
+ broadcastable: true,
25373
+ signature: "(number) -> integer",
25374
+ sgn: ([x]) => x.sgn,
25375
+ evaluate: ([x]) => apply(
25376
+ x,
25377
+ Math.trunc,
25378
+ (x2) => x2.trunc(),
25379
+ (z) => z.trunc(0)
25380
+ )
25312
25381
  }
25313
25382
  },
25314
25383
  {
@@ -32468,26 +32537,23 @@ function monteCarloEstimate(f, a, b, n = 1e5) {
32468
32537
  for (let i = 0; i < n; i++) {
32469
32538
  const u = Math.random();
32470
32539
  const x = Math.tan(Math.PI * (u - 0.5));
32471
- const jacobian = Math.PI * (1 + x * x);
32472
- const val = f(x) / jacobian;
32540
+ const val = f(x) * Math.PI * (1 + x * x);
32473
32541
  sum2 += val;
32474
32542
  sumSq += val * val;
32475
32543
  }
32476
32544
  } else if (a === -Infinity) {
32477
32545
  for (let i = 0; i < n; i++) {
32478
32546
  const u = Math.random();
32479
- const x = b - Math.log(1 - u);
32480
- const jacobian = 1 / (1 - u);
32481
- const val = f(x) / jacobian;
32547
+ const x = b + Math.log(u);
32548
+ const val = f(x) / u;
32482
32549
  sum2 += val;
32483
32550
  sumSq += val * val;
32484
32551
  }
32485
32552
  } else if (b === Infinity) {
32486
32553
  for (let i = 0; i < n; i++) {
32487
32554
  const u = Math.random();
32488
- const x = a + Math.log(u);
32489
- const jacobian = 1 / u;
32490
- const val = f(x) / jacobian;
32555
+ const x = a - Math.log(u);
32556
+ const val = f(x) / u;
32491
32557
  sum2 += val;
32492
32558
  sumSq += val * val;
32493
32559
  }
@@ -32501,7 +32567,7 @@ function monteCarloEstimate(f, a, b, n = 1e5) {
32501
32567
  const mean2 = sum2 / n;
32502
32568
  const variance2 = (sumSq - n * mean2 * mean2) / (n - 1);
32503
32569
  const stdError = Math.sqrt(variance2 / n);
32504
- const scale = b - a;
32570
+ const scale = isFinite(a) && isFinite(b) ? b - a : 1;
32505
32571
  const estimate = mean2 * scale;
32506
32572
  const error = stdError * scale;
32507
32573
  const rounded = roundEstimateToError(estimate, error);
@@ -32603,7 +32669,7 @@ var DERIVATIVES_TABLE = {
32603
32669
  ]
32604
32670
  ],
32605
32671
  // d/dx ln(Γ(x)) = ψ(x) (digamma function)
32606
- LogGamma: ["Digamma", "_"],
32672
+ GammaLn: ["Digamma", "_"],
32607
32673
  // d/dx ψ(x) = ψ₁(x) (trigamma function)
32608
32674
  // https://en.wikipedia.org/wiki/Trigamma_function
32609
32675
  Digamma: ["Trigamma", "_"],
@@ -34081,10 +34147,10 @@ function antiderivative(fn, index) {
34081
34147
  if (numDeg >= 0 && denDeg >= 0 && numDeg >= denDeg) {
34082
34148
  const divResult = polynomialDivide(fn.op1, fn.op2, index);
34083
34149
  if (divResult) {
34084
- const [quotient, remainder] = divResult;
34150
+ const [quotient, remainder2] = divResult;
34085
34151
  const quotientIntegral = antiderivative(quotient, index);
34086
- if (!remainder.is(0)) {
34087
- const remainderFraction = remainder.div(fn.op2);
34152
+ if (!remainder2.is(0)) {
34153
+ const remainderFraction = remainder2.div(fn.op2);
34088
34154
  const remainderIntegral = antiderivative(remainderFraction, index);
34089
34155
  return add3(quotientIntegral, remainderIntegral);
34090
34156
  }
@@ -34339,8 +34405,8 @@ function antiderivative(fn, index) {
34339
34405
  const linearFactor = ce.symbol(index).sub(r);
34340
34406
  const quotient = polynomialDivide(denominator, linearFactor, index);
34341
34407
  if (quotient) {
34342
- const [quad, remainder] = quotient;
34343
- if (remainder.is(0)) {
34408
+ const [quad, remainder2] = quotient;
34409
+ if (remainder2.is(0)) {
34344
34410
  const quadCoeffs = getQuadraticCoefficients(quad, index);
34345
34411
  if (quadCoeffs) {
34346
34412
  const { a: qa, b: qb, c: qc } = quadCoeffs;
@@ -35595,8 +35661,7 @@ function numberForm(expr) {
35595
35661
  function multiplyForm(expr) {
35596
35662
  if (!expr.ops) return expr;
35597
35663
  const ops = expr.ops.map(multiplyForm);
35598
- if (expr.operator === "Multiply")
35599
- return canonicalMultiply(expr.engine, ops);
35664
+ if (expr.operator === "Multiply") return canonicalMultiply(expr.engine, ops);
35600
35665
  if (expr.operator === "Negate")
35601
35666
  return canonicalMultiply(expr.engine, [ops[0], expr.engine.NegativeOne]);
35602
35667
  return expr;
@@ -45969,7 +46034,8 @@ var BoxedFunction = class extends _BoxedExpression {
45969
46034
  return this.numeratorDenominator[1];
45970
46035
  }
45971
46036
  get numeratorDenominator() {
45972
- if (!(this.isCanonical || this.isStructural)) return [this, this.engine.One];
46037
+ if (!(this.isCanonical || this.isStructural))
46038
+ return [this, this.engine.One];
45973
46039
  if (this.isNumber !== true)
45974
46040
  return [this.engine.Nothing, this.engine.Nothing];
45975
46041
  const operator2 = this.operator;
@@ -46007,11 +46073,13 @@ var BoxedFunction = class extends _BoxedExpression {
46007
46073
  // ALGEBRAIC OPERATIONS
46008
46074
  //
46009
46075
  neg() {
46010
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46076
+ if (!(this.isCanonical || this.isStructural))
46077
+ throw new Error("Not canonical");
46011
46078
  return negate(this);
46012
46079
  }
46013
46080
  inv() {
46014
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46081
+ if (!(this.isCanonical || this.isStructural))
46082
+ throw new Error("Not canonical");
46015
46083
  if (this.isOne) return this;
46016
46084
  if (this.isNegativeOne) return this;
46017
46085
  if (this.operator === "Sqrt") return this.op1.inv().sqrt();
@@ -46032,7 +46100,8 @@ var BoxedFunction = class extends _BoxedExpression {
46032
46100
  return this.engine._fn("Divide", [this.engine.One, this]);
46033
46101
  }
46034
46102
  abs() {
46035
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46103
+ if (!(this.isCanonical || this.isStructural))
46104
+ throw new Error("Not canonical");
46036
46105
  if (this.operator === "Abs" || this.operator === "Negate") return this;
46037
46106
  if (this.isNonNegative) return this;
46038
46107
  if (this.isNonPositive) return this.neg();
@@ -46040,11 +46109,13 @@ var BoxedFunction = class extends _BoxedExpression {
46040
46109
  }
46041
46110
  add(rhs) {
46042
46111
  if (rhs === 0) return this;
46043
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46112
+ if (!(this.isCanonical || this.isStructural))
46113
+ throw new Error("Not canonical");
46044
46114
  return add3(this, this.engine.box(rhs));
46045
46115
  }
46046
46116
  mul(rhs) {
46047
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46117
+ if (!(this.isCanonical || this.isStructural))
46118
+ throw new Error("Not canonical");
46048
46119
  if (rhs === 0) return this.engine.Zero;
46049
46120
  if (rhs === 1) return this;
46050
46121
  if (rhs === -1) return this.neg();
@@ -46056,7 +46127,8 @@ var BoxedFunction = class extends _BoxedExpression {
46056
46127
  return mul3(this, this.engine.box(rhs));
46057
46128
  }
46058
46129
  div(rhs) {
46059
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46130
+ if (!(this.isCanonical || this.isStructural))
46131
+ throw new Error("Not canonical");
46060
46132
  return div2(this, rhs);
46061
46133
  }
46062
46134
  pow(exp3) {
@@ -46122,7 +46194,8 @@ var BoxedFunction = class extends _BoxedExpression {
46122
46194
  }
46123
46195
  ln(semiBase) {
46124
46196
  const base = semiBase ? this.engine.box(semiBase) : void 0;
46125
- if (!(this.isCanonical || this.isStructural)) throw new Error("Not canonical");
46197
+ if (!(this.isCanonical || this.isStructural))
46198
+ throw new Error("Not canonical");
46126
46199
  if (this.is(0)) return this.engine.NegativeInfinity;
46127
46200
  if (this.operator === "Exp") {
46128
46201
  if (!base) return this.op1;
@@ -51457,7 +51530,7 @@ var JAVASCRIPT_FUNCTIONS = {
51457
51530
  Arsinh: "Math.asinh",
51458
51531
  Arctan: "Math.atan",
51459
51532
  Artanh: "Math.atanh",
51460
- Ceiling: "Math.ceil",
51533
+ Ceil: "Math.ceil",
51461
51534
  Chop: "_SYS.chop",
51462
51535
  Cos: "Math.cos",
51463
51536
  Cosh: "Math.cosh",
@@ -51487,10 +51560,7 @@ var JAVASCRIPT_FUNCTIONS = {
51487
51560
  Floor: "Math.floor",
51488
51561
  Fract: ([x], compile) => {
51489
51562
  if (x === null) throw new Error("Fract: no argument");
51490
- return BaseCompiler.inlineExpression(
51491
- "${x} - Math.floor(${x})",
51492
- compile(x)
51493
- );
51563
+ return BaseCompiler.inlineExpression("${x} - Math.floor(${x})", compile(x));
51494
51564
  },
51495
51565
  Gamma: "_SYS.gamma",
51496
51566
  GCD: "_SYS.gcd",
@@ -51503,7 +51573,7 @@ var JAVASCRIPT_FUNCTIONS = {
51503
51573
  if (args.length === 1) return `Math.log10(${compile(args[0])})`;
51504
51574
  return `(Math.log(${compile(args[0])}) / Math.log(${compile(args[1])}))`;
51505
51575
  },
51506
- LogGamma: "_SYS.lngamma",
51576
+ GammaLn: "_SYS.lngamma",
51507
51577
  Lb: "Math.log2",
51508
51578
  Max: "Math.max",
51509
51579
  Mean: (args, compile) => {
@@ -51632,12 +51702,23 @@ var JAVASCRIPT_FUNCTIONS = {
51632
51702
  if (arg === null) throw new Error("Sech: no argument");
51633
51703
  return `1 / Math.cosh(${compile(arg)})`;
51634
51704
  },
51635
- Sgn: "Math.sign",
51705
+ Sign: "Math.sign",
51636
51706
  Sin: "Math.sin",
51637
51707
  Sinh: "Math.sinh",
51638
51708
  Sqrt: "Math.sqrt",
51639
51709
  Tan: "Math.tan",
51640
- Tanh: "Math.tanh"
51710
+ Tanh: "Math.tanh",
51711
+ Mod: ([a, b], compile) => {
51712
+ if (a === null || b === null) throw new Error("Mod: missing argument");
51713
+ const ca = compile(a);
51714
+ const cb = compile(b);
51715
+ return `((${ca} % ${cb}) + ${cb}) % ${cb}`;
51716
+ },
51717
+ Truncate: "Math.trunc",
51718
+ Remainder: ([a, b], compile) => {
51719
+ if (a === null || b === null) throw new Error("Remainder: missing argument");
51720
+ return `(${compile(a)} - ${compile(b)} * Math.round(${compile(a)} / ${compile(b)}))`;
51721
+ }
51641
51722
  };
51642
51723
  var ComputeEngineFunction = class extends Function {
51643
51724
  SYS = {
@@ -51900,7 +51981,7 @@ var GLSL_FUNCTIONS = {
51900
51981
  Arccos: "acos",
51901
51982
  Arcsin: "asin",
51902
51983
  Arctan: "atan",
51903
- Ceiling: "ceil",
51984
+ Ceil: "ceil",
51904
51985
  Clamp: "clamp",
51905
51986
  Cos: "cos",
51906
51987
  Degrees: "degrees",
@@ -51925,6 +52006,11 @@ var GLSL_FUNCTIONS = {
51925
52006
  Sqrt: "sqrt",
51926
52007
  Step: "step",
51927
52008
  Tan: "tan",
52009
+ Truncate: "trunc",
52010
+ Remainder: ([a, b], compile) => {
52011
+ if (a === null || b === null) throw new Error("Remainder: missing argument");
52012
+ return `(${compile(a)} - ${compile(b)} * round(${compile(a)} / ${compile(b)}))`;
52013
+ },
51928
52014
  // Reciprocal trigonometric functions (no GLSL built-ins)
51929
52015
  Cot: ([x], compile) => {
51930
52016
  if (x === null) throw new Error("Cot: no argument");
@@ -51988,7 +52074,7 @@ var GLSL_FUNCTIONS = {
51988
52074
  return `acosh(1.0 / (${compile(x)}))`;
51989
52075
  },
51990
52076
  // Additional math functions
51991
- Sgn: "sign",
52077
+ // Sign is already registered in the standard functions above
51992
52078
  Lb: "log2",
51993
52079
  Log: (args, compile) => {
51994
52080
  if (args.length === 0) throw new Error("Log: no argument");
@@ -52586,6 +52672,22 @@ function fract(x) {
52586
52672
  }
52587
52673
  return { kind: "singular", at: flo + 1, continuity: "right" };
52588
52674
  }
52675
+ function trunc2(x) {
52676
+ const unwrapped = unwrapOrPropagate(x);
52677
+ if (!Array.isArray(unwrapped)) return unwrapped;
52678
+ const [xVal] = unwrapped;
52679
+ const tlo = Math.trunc(xVal.lo);
52680
+ const thi = Math.trunc(xVal.hi);
52681
+ if (tlo === thi) return ok({ lo: tlo, hi: thi });
52682
+ if (xVal.lo >= 0) {
52683
+ return { kind: "singular", at: tlo + 1, continuity: "right" };
52684
+ }
52685
+ const firstInt = Math.ceil(xVal.lo);
52686
+ if (firstInt !== 0) {
52687
+ return { kind: "singular", at: firstInt, continuity: "left" };
52688
+ }
52689
+ return { kind: "singular", at: 1, continuity: "right" };
52690
+ }
52589
52691
  function min2(a, b) {
52590
52692
  const unwrapped = unwrapOrPropagate(a, b);
52591
52693
  if (!Array.isArray(unwrapped)) return unwrapped;
@@ -52611,7 +52713,9 @@ function mod2(a, b) {
52611
52713
  if (containsZero(bVal)) {
52612
52714
  return { kind: "singular" };
52613
52715
  }
52614
- const period = Math.abs(bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi)));
52716
+ const period = Math.abs(
52717
+ bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi))
52718
+ );
52615
52719
  const flo = Math.floor(aVal.lo / period);
52616
52720
  const fhi = Math.floor(aVal.hi / period);
52617
52721
  if (flo !== fhi) {
@@ -52621,6 +52725,9 @@ function mod2(a, b) {
52621
52725
  const modHi = aVal.hi - period * flo;
52622
52726
  return ok({ lo: Math.min(modLo, modHi), hi: Math.max(modLo, modHi) });
52623
52727
  }
52728
+ function remainder(a, b) {
52729
+ return sub2(a, mul4(b, round2(div3(a, b))));
52730
+ }
52624
52731
  function sign2(x) {
52625
52732
  const unwrapped = unwrapOrPropagate(x);
52626
52733
  if (!Array.isArray(unwrapped)) return unwrapped;
@@ -53111,9 +53218,11 @@ var IntervalArithmetic = {
53111
53218
  ceil: ceil2,
53112
53219
  round: round2,
53113
53220
  fract,
53221
+ trunc: trunc2,
53114
53222
  min: min2,
53115
53223
  max: max2,
53116
53224
  mod: mod2,
53225
+ remainder,
53117
53226
  sign: sign2,
53118
53227
  // Trigonometric
53119
53228
  sin: sin2,
@@ -53219,7 +53328,7 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
53219
53328
  Negate: (args, compile) => `_IA.negate(${compile(args[0])})`,
53220
53329
  // Elementary functions
53221
53330
  Abs: (args, compile) => `_IA.abs(${compile(args[0])})`,
53222
- Ceiling: (args, compile) => `_IA.ceil(${compile(args[0])})`,
53331
+ Ceil: (args, compile) => `_IA.ceil(${compile(args[0])})`,
53223
53332
  Exp: (args, compile) => `_IA.exp(${compile(args[0])})`,
53224
53333
  Floor: (args, compile) => `_IA.floor(${compile(args[0])})`,
53225
53334
  Ln: (args, compile) => `_IA.ln(${compile(args[0])})`,
@@ -53272,7 +53381,7 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
53272
53381
  return `_IA.powInterval(${compile(arg)}, _IA.div(_IA.point(1), ${compile(exp3)}))`;
53273
53382
  },
53274
53383
  Round: (args, compile) => `_IA.round(${compile(args[0])})`,
53275
- Sgn: (args, compile) => `_IA.sign(${compile(args[0])})`,
53384
+ Sign: (args, compile) => `_IA.sign(${compile(args[0])})`,
53276
53385
  Sqrt: (args, compile) => `_IA.sqrt(${compile(args[0])})`,
53277
53386
  Square: (args, compile) => `_IA.square(${compile(args[0])})`,
53278
53387
  // Trigonometric functions
@@ -53301,14 +53410,12 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
53301
53410
  Arcoth: (args, compile) => `_IA.acoth(${compile(args[0])})`,
53302
53411
  Arcsch: (args, compile) => `_IA.acsch(${compile(args[0])})`,
53303
53412
  Arsech: (args, compile) => `_IA.asech(${compile(args[0])})`,
53304
- // Inverse trig (alternative names)
53305
- Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
53306
- Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
53307
- Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
53308
53413
  // Elementary
53309
53414
  Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
53310
- // Mod
53415
+ Truncate: (args, compile) => `_IA.trunc(${compile(args[0])})`,
53416
+ // Mod / Remainder
53311
53417
  Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
53418
+ Remainder: (args, compile) => `_IA.remainder(${compile(args[0])}, ${compile(args[1])})`,
53312
53419
  // Conditionals
53313
53420
  If: (args, compile) => {
53314
53421
  if (args.length !== 3) throw new Error("If: wrong number of arguments");
@@ -53628,6 +53735,22 @@ IntervalResult ia_ln(vec2 x) {
53628
53735
  return ia_partial(vec2(-IA_HUGE, log(x.y) + IA_EPS), IA_PARTIAL_LO);
53629
53736
  }
53630
53737
 
53738
+ // Log base 2
53739
+ IntervalResult ia_log2(vec2 x) {
53740
+ const float INV_LN2 = 1.44269504089;
53741
+ if (x.y <= 0.0) return ia_empty();
53742
+ if (x.x > 0.0) return ia_ok(vec2(log2(x.x) - IA_EPS, log2(x.y) + IA_EPS));
53743
+ return ia_partial(vec2(-IA_HUGE, log2(x.y) + IA_EPS), IA_PARTIAL_LO);
53744
+ }
53745
+
53746
+ // Log base 10
53747
+ IntervalResult ia_log10(vec2 x) {
53748
+ const float INV_LN10 = 0.43429448190;
53749
+ if (x.y <= 0.0) return ia_empty();
53750
+ if (x.x > 0.0) return ia_ok(vec2(log(x.x) * INV_LN10 - IA_EPS, log(x.y) * INV_LN10 + IA_EPS));
53751
+ return ia_partial(vec2(-IA_HUGE, log(x.y) * INV_LN10 + IA_EPS), IA_PARTIAL_LO);
53752
+ }
53753
+
53631
53754
  // Absolute value
53632
53755
  IntervalResult ia_abs(vec2 x) {
53633
53756
  if (x.x >= 0.0) {
@@ -53701,6 +53824,18 @@ IntervalResult ia_fract(vec2 x) {
53701
53824
  return ia_singular_right(flo + 1.0);
53702
53825
  }
53703
53826
 
53827
+ // Truncate toward zero - floor for positive, ceil for negative
53828
+ // Discontinuous at every non-zero integer, continuous at zero
53829
+ IntervalResult ia_trunc(vec2 x) {
53830
+ float tlo = trunc(x.x);
53831
+ float thi = trunc(x.y);
53832
+ if (tlo == thi) return ia_ok(vec2(tlo, thi));
53833
+ if (x.x >= 0.0) return ia_singular_right(tlo + 1.0); // like floor
53834
+ float firstInt = ceil(x.x);
53835
+ if (firstInt != 0.0) return ia_singular_left(firstInt); // like ceil
53836
+ return ia_singular_right(1.0); // spans zero, first discontinuity at +1
53837
+ }
53838
+
53704
53839
  // Mod - periodic discontinuities at multiples of the modulus
53705
53840
  // mod(x, y) = x - y * floor(x / y)
53706
53841
  IntervalResult ia_mod(vec2 x, vec2 y) {
@@ -53734,6 +53869,16 @@ IntervalResult ia_mod(vec2 x, vec2 y) {
53734
53869
  return ia_sub(x, ia_mul_raw(y, fq.value));
53735
53870
  }
53736
53871
 
53872
+ // IEEE remainder: a - b * round(a / b)
53873
+ // Discontinuities arise from round when a/b spans a half-integer
53874
+ IntervalResult ia_remainder(vec2 a, vec2 b) {
53875
+ IntervalResult q = ia_div(a, b);
53876
+ if (ia_is_error(q.status)) return q;
53877
+ IntervalResult rq = ia_round(q.value);
53878
+ if (ia_is_error(rq.status)) return rq;
53879
+ return ia_sub(a, ia_mul_raw(b, rq.value));
53880
+ }
53881
+
53737
53882
  // Min of two intervals
53738
53883
  IntervalResult ia_min(vec2 a, vec2 b) {
53739
53884
  return ia_ok(vec2(min(a.x, b.x), min(a.y, b.y)));
@@ -54000,6 +54145,16 @@ IntervalResult ia_ln(IntervalResult x) {
54000
54145
  return ia_ln(x.value);
54001
54146
  }
54002
54147
 
54148
+ IntervalResult ia_log2(IntervalResult x) {
54149
+ if (ia_is_error(x.status)) return x;
54150
+ return ia_log2(x.value);
54151
+ }
54152
+
54153
+ IntervalResult ia_log10(IntervalResult x) {
54154
+ if (ia_is_error(x.status)) return x;
54155
+ return ia_log10(x.value);
54156
+ }
54157
+
54003
54158
  IntervalResult ia_abs(IntervalResult x) {
54004
54159
  if (ia_is_error(x.status)) return x;
54005
54160
  return ia_abs(x.value);
@@ -54030,6 +54185,11 @@ IntervalResult ia_fract(IntervalResult x) {
54030
54185
  return ia_fract(x.value);
54031
54186
  }
54032
54187
 
54188
+ IntervalResult ia_trunc(IntervalResult x) {
54189
+ if (ia_is_error(x.status)) return x;
54190
+ return ia_trunc(x.value);
54191
+ }
54192
+
54033
54193
  IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
54034
54194
  if (ia_is_error(a.status)) return a;
54035
54195
  if (ia_is_error(b.status)) return b;
@@ -54046,6 +54206,22 @@ IntervalResult ia_mod(vec2 a, IntervalResult b) {
54046
54206
  return ia_mod(a, b.value);
54047
54207
  }
54048
54208
 
54209
+ IntervalResult ia_remainder(IntervalResult a, IntervalResult b) {
54210
+ if (ia_is_error(a.status)) return a;
54211
+ if (ia_is_error(b.status)) return b;
54212
+ return ia_remainder(a.value, b.value);
54213
+ }
54214
+
54215
+ IntervalResult ia_remainder(IntervalResult a, vec2 b) {
54216
+ if (ia_is_error(a.status)) return a;
54217
+ return ia_remainder(a.value, b);
54218
+ }
54219
+
54220
+ IntervalResult ia_remainder(vec2 a, IntervalResult b) {
54221
+ if (ia_is_error(b.status)) return b;
54222
+ return ia_remainder(a, b.value);
54223
+ }
54224
+
54049
54225
  IntervalResult ia_min(IntervalResult a, IntervalResult b) {
54050
54226
  if (ia_is_error(a.status)) return a;
54051
54227
  if (ia_is_error(b.status)) return b;
@@ -54432,12 +54608,19 @@ var INTERVAL_GLSL_FUNCTIONS = {
54432
54608
  Negate: (args, compile) => `ia_negate(${compile(args[0])})`,
54433
54609
  // Elementary functions
54434
54610
  Abs: (args, compile) => `ia_abs(${compile(args[0])})`,
54435
- Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
54611
+ Ceil: (args, compile) => `ia_ceil(${compile(args[0])})`,
54436
54612
  Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
54437
54613
  Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
54438
54614
  Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
54615
+ Truncate: (args, compile) => `ia_trunc(${compile(args[0])})`,
54616
+ Lb: (args, compile) => `ia_log2(${compile(args[0])})`,
54439
54617
  Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
54618
+ Log: (args, compile) => {
54619
+ if (args.length === 1) return `ia_log10(${compile(args[0])})`;
54620
+ return `ia_div(ia_ln(${compile(args[0])}), ia_ln(${compile(args[1])}))`;
54621
+ },
54440
54622
  Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
54623
+ Remainder: (args, compile) => `ia_remainder(${compile(args[0])}, ${compile(args[1])})`,
54441
54624
  Max: (args, compile) => {
54442
54625
  if (args.length === 0) return "ia_point(-1e38)";
54443
54626
  if (args.length === 1) return compile(args[0]);
@@ -54470,8 +54653,17 @@ var INTERVAL_GLSL_FUNCTIONS = {
54470
54653
  }
54471
54654
  throw new Error("Interval GLSL does not support variable exponents");
54472
54655
  },
54656
+ Root: (args, compile) => {
54657
+ const [arg, exp3] = args;
54658
+ if (arg === null) throw new Error("Root: no argument");
54659
+ if (exp3 === null || exp3?.re === 2) return `ia_sqrt(${compile(arg)})`;
54660
+ if (exp3?.isNumberLiteral && exp3.im === 0) {
54661
+ return `ia_pow(${compile(arg)}, ${1 / exp3.re})`;
54662
+ }
54663
+ throw new Error("Interval GLSL does not support variable root indices");
54664
+ },
54473
54665
  Round: (args, compile) => `ia_round(${compile(args[0])})`,
54474
- Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
54666
+ Sign: (args, compile) => `ia_sign(${compile(args[0])})`,
54475
54667
  Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
54476
54668
  Square: (args, compile) => `ia_square(${compile(args[0])})`,
54477
54669
  // Trigonometric functions
@@ -56412,10 +56604,10 @@ function defToString(name, def, v) {
56412
56604
  // src/compute-engine.ts
56413
56605
  init_types6();
56414
56606
  init_base_compiler();
56415
- var version = "0.35.4";
56607
+ var version = "0.35.6";
56416
56608
  globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
56417
56609
  ComputeEngine: ComputeEngine.prototype.constructor,
56418
- version: "0.35.4"
56610
+ version: "0.35.6"
56419
56611
  };
56420
56612
  export {
56421
56613
  BaseCompiler,