@cortex-js/compute-engine 0.35.2 → 0.35.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compute-engine.esm.js +630 -30
- package/dist/compute-engine.min.esm.js +421 -53
- package/dist/compute-engine.min.umd.js +421 -53
- package/dist/compute-engine.umd.js +630 -30
- package/dist/math-json.esm.js +2 -2
- package/dist/math-json.min.esm.js +2 -2
- package/dist/math-json.min.umd.js +2 -2
- package/dist/math-json.umd.js +2 -2
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/configuration-change.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +1 -1
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +1 -1
- package/dist/types/common/one-of.d.ts +1 -1
- package/dist/types/common/signals.d.ts +1 -1
- package/dist/types/common/type/ast-nodes.d.ts +1 -1
- package/dist/types/common/type/boxed-type.d.ts +1 -1
- package/dist/types/common/type/lexer.d.ts +1 -1
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/parser.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +1 -1
- package/dist/types/common/type/reduce.d.ts +1 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/type-builder.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +1 -1
- package/dist/types/common/type/utils.d.ts +1 -1
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve-linear-system.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +1 -1
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compilation/base-compiler.d.ts +1 -1
- package/dist/types/compute-engine/compilation/glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-glsl-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/interval-javascript-target.d.ts +11 -1
- package/dist/types/compute-engine/compilation/javascript-target.d.ts +1 -1
- package/dist/types/compute-engine/compilation/types.d.ts +1 -1
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/global-types.d.ts +1 -1
- package/dist/types/compute-engine/index.d.ts +1 -1
- package/dist/types/compute-engine/interval/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/interval/comparison.d.ts +1 -1
- package/dist/types/compute-engine/interval/elementary.d.ts +24 -5
- package/dist/types/compute-engine/interval/index.d.ts +15 -5
- package/dist/types/compute-engine/interval/trigonometric.d.ts +55 -1
- package/dist/types/compute-engine/interval/types.d.ts +2 -1
- package/dist/types/compute-engine/interval/util.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/types.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/utils.d.ts +1 -1
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +1 -1
- package/dist/types/compute-engine/library/combinatorics.d.ts +1 -1
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/invisible-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/library.d.ts +1 -1
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-analysis.d.ts +1 -1
- package/dist/types/compute-engine/library/logic-utils.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/number-theory.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +1 -1
- package/dist/types/compute-engine/numeric-value/types.d.ts +1 -1
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +1 -1
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -1
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +1 -1
- package/dist/types/compute-engine/numerics/statistics.d.ts +1 -1
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +1 -1
- package/dist/types/compute-engine/oeis.d.ts +1 -1
- package/dist/types/compute-engine/sequence.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/antiderivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-cost.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu-transforms.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/fu.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-abs.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-divide.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-hyperbolic.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-infinity.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-log.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-power.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-product.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-sum.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-trig.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensor-fields.d.ts +1 -1
- package/dist/types/compute-engine/tensor/tensors.d.ts +1 -1
- package/dist/types/compute-engine/types.d.ts +1 -1
- package/dist/types/compute-engine.d.ts +1 -1
- package/dist/types/math-json/symbols.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +1 -1
- package/dist/types/math-json/utils.d.ts +1 -1
- package/dist/types/math-json.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compute Engine 0.35.
|
|
1
|
+
/** Compute Engine 0.35.4 */
|
|
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;
|
|
@@ -51499,6 +51499,13 @@ Error in definition of "${name}"`,
|
|
|
51499
51499
|
},
|
|
51500
51500
|
Exp: "Math.exp",
|
|
51501
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
|
+
},
|
|
51502
51509
|
Gamma: "_SYS.gamma",
|
|
51503
51510
|
GCD: "_SYS.gcd",
|
|
51504
51511
|
Integrate: (args, compile, target) => compileIntegrate(args, compile, target),
|
|
@@ -51932,6 +51939,87 @@ Error in definition of "${name}"`,
|
|
|
51932
51939
|
Sqrt: "sqrt",
|
|
51933
51940
|
Step: "step",
|
|
51934
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
|
+
},
|
|
51935
52023
|
// Vector/Matrix operations
|
|
51936
52024
|
Cross: "cross",
|
|
51937
52025
|
Distance: "distance",
|
|
@@ -52478,19 +52566,39 @@ Error in definition of "${name}"`,
|
|
|
52478
52566
|
const unwrapped = unwrapOrPropagate(x);
|
|
52479
52567
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52480
52568
|
const [xVal] = unwrapped;
|
|
52481
|
-
|
|
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, continuity: "right" };
|
|
52482
52573
|
}
|
|
52483
52574
|
function ceil2(x) {
|
|
52484
52575
|
const unwrapped = unwrapOrPropagate(x);
|
|
52485
52576
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52486
52577
|
const [xVal] = unwrapped;
|
|
52487
|
-
|
|
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, continuity: "left" };
|
|
52488
52582
|
}
|
|
52489
52583
|
function round2(x) {
|
|
52490
52584
|
const unwrapped = unwrapOrPropagate(x);
|
|
52491
52585
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52492
52586
|
const [xVal] = unwrapped;
|
|
52493
|
-
|
|
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, continuity: "right" };
|
|
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, continuity: "right" };
|
|
52494
52602
|
}
|
|
52495
52603
|
function min2(a, b) {
|
|
52496
52604
|
const unwrapped = unwrapOrPropagate(a, b);
|
|
@@ -52517,18 +52625,15 @@ Error in definition of "${name}"`,
|
|
|
52517
52625
|
if (containsZero(bVal)) {
|
|
52518
52626
|
return { kind: "singular" };
|
|
52519
52627
|
}
|
|
52520
|
-
const
|
|
52521
|
-
const
|
|
52522
|
-
|
|
52523
|
-
|
|
52524
|
-
|
|
52525
|
-
const modLo = (aVal.lo % bAbs + bAbs) % bAbs;
|
|
52526
|
-
const modHi = (aVal.hi % bAbs + bAbs) % bAbs;
|
|
52527
|
-
if (modLo <= modHi) {
|
|
52528
|
-
return ok({ lo: modLo, hi: modHi });
|
|
52529
|
-
} else {
|
|
52530
|
-
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, continuity: "right" };
|
|
52531
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) });
|
|
52532
52637
|
}
|
|
52533
52638
|
function sign2(x) {
|
|
52534
52639
|
const unwrapped = unwrapOrPropagate(x);
|
|
@@ -52537,9 +52642,7 @@ Error in definition of "${name}"`,
|
|
|
52537
52642
|
if (xVal.lo > 0) return ok({ lo: 1, hi: 1 });
|
|
52538
52643
|
if (xVal.hi < 0) return ok({ lo: -1, hi: -1 });
|
|
52539
52644
|
if (xVal.lo === 0 && xVal.hi === 0) return ok({ lo: 0, hi: 0 });
|
|
52540
|
-
|
|
52541
|
-
if (xVal.lo === 0) return ok({ lo: 0, hi: 1 });
|
|
52542
|
-
return ok({ lo: -1, hi: 0 });
|
|
52645
|
+
return { kind: "singular", at: 0 };
|
|
52543
52646
|
}
|
|
52544
52647
|
|
|
52545
52648
|
// src/compute-engine/interval/trigonometric.ts
|
|
@@ -52799,6 +52902,81 @@ Error in definition of "${name}"`,
|
|
|
52799
52902
|
}
|
|
52800
52903
|
return ok({ lo: Math.atanh(xVal.lo), hi: Math.atanh(xVal.hi) });
|
|
52801
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
|
+
}
|
|
52802
52980
|
|
|
52803
52981
|
// src/compute-engine/interval/comparison.ts
|
|
52804
52982
|
function less(a, b) {
|
|
@@ -52946,6 +53124,7 @@ Error in definition of "${name}"`,
|
|
|
52946
53124
|
floor: floor2,
|
|
52947
53125
|
ceil: ceil2,
|
|
52948
53126
|
round: round2,
|
|
53127
|
+
fract,
|
|
52949
53128
|
min: min2,
|
|
52950
53129
|
max: max2,
|
|
52951
53130
|
mod: mod2,
|
|
@@ -52967,6 +53146,15 @@ Error in definition of "${name}"`,
|
|
|
52967
53146
|
asinh: asinh2,
|
|
52968
53147
|
acosh: acosh2,
|
|
52969
53148
|
atanh: atanh2,
|
|
53149
|
+
acot,
|
|
53150
|
+
acsc,
|
|
53151
|
+
asec,
|
|
53152
|
+
coth,
|
|
53153
|
+
csch,
|
|
53154
|
+
sech,
|
|
53155
|
+
acoth,
|
|
53156
|
+
acsch,
|
|
53157
|
+
asech,
|
|
52970
53158
|
// Comparison
|
|
52971
53159
|
less,
|
|
52972
53160
|
lessEqual,
|
|
@@ -53111,17 +53299,28 @@ Error in definition of "${name}"`,
|
|
|
53111
53299
|
Arcsin: (args, compile) => `_IA.asin(${compile(args[0])})`,
|
|
53112
53300
|
Arccos: (args, compile) => `_IA.acos(${compile(args[0])})`,
|
|
53113
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])})`,
|
|
53114
53305
|
// Hyperbolic functions
|
|
53115
53306
|
Sinh: (args, compile) => `_IA.sinh(${compile(args[0])})`,
|
|
53116
53307
|
Cosh: (args, compile) => `_IA.cosh(${compile(args[0])})`,
|
|
53117
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])})`,
|
|
53118
53312
|
Arsinh: (args, compile) => `_IA.asinh(${compile(args[0])})`,
|
|
53119
53313
|
Arcosh: (args, compile) => `_IA.acosh(${compile(args[0])})`,
|
|
53120
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])})`,
|
|
53121
53318
|
// Inverse trig (alternative names)
|
|
53122
53319
|
Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
|
|
53123
53320
|
Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
|
|
53124
53321
|
Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
|
|
53322
|
+
// Elementary
|
|
53323
|
+
Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
|
|
53125
53324
|
// Mod
|
|
53126
53325
|
Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
|
|
53127
53326
|
// Conditionals
|
|
@@ -53283,6 +53482,8 @@ const float IA_SINGULAR = 3.0;
|
|
|
53283
53482
|
const float IA_PARTIAL_LO = 4.0;
|
|
53284
53483
|
const float IA_PARTIAL_HI = 5.0;
|
|
53285
53484
|
const float IA_PARTIAL_BOTH = 6.0;
|
|
53485
|
+
const float IA_SINGULAR_RIGHT = 7.0;
|
|
53486
|
+
const float IA_SINGULAR_LEFT = 8.0;
|
|
53286
53487
|
|
|
53287
53488
|
// Interval result struct
|
|
53288
53489
|
struct IntervalResult {
|
|
@@ -53316,12 +53517,20 @@ IntervalResult ia_singular(float at) {
|
|
|
53316
53517
|
return IntervalResult(vec2(at, at), IA_SINGULAR);
|
|
53317
53518
|
}
|
|
53318
53519
|
|
|
53520
|
+
IntervalResult ia_singular_right(float at) {
|
|
53521
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_RIGHT);
|
|
53522
|
+
}
|
|
53523
|
+
|
|
53524
|
+
IntervalResult ia_singular_left(float at) {
|
|
53525
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_LEFT);
|
|
53526
|
+
}
|
|
53527
|
+
|
|
53319
53528
|
IntervalResult ia_partial(vec2 v, float clip) {
|
|
53320
53529
|
return IntervalResult(v, clip);
|
|
53321
53530
|
}
|
|
53322
53531
|
|
|
53323
53532
|
bool ia_is_error(float status) {
|
|
53324
|
-
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR;
|
|
53533
|
+
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR || status == IA_SINGULAR_RIGHT || status == IA_SINGULAR_LEFT;
|
|
53325
53534
|
}
|
|
53326
53535
|
|
|
53327
53536
|
// Addition
|
|
@@ -53444,24 +53653,99 @@ IntervalResult ia_abs(vec2 x) {
|
|
|
53444
53653
|
return ia_ok(vec2(0.0, max(-x.x, x.y)));
|
|
53445
53654
|
}
|
|
53446
53655
|
|
|
53447
|
-
// Sign function
|
|
53656
|
+
// Sign function - has jump discontinuity at 0
|
|
53448
53657
|
IntervalResult ia_sign(vec2 x) {
|
|
53449
53658
|
if (x.x > 0.0) return ia_ok(vec2(1.0, 1.0));
|
|
53450
53659
|
if (x.y < 0.0) return ia_ok(vec2(-1.0, -1.0));
|
|
53451
53660
|
if (x.x == 0.0 && x.y == 0.0) return ia_ok(vec2(0.0, 0.0));
|
|
53452
|
-
|
|
53453
|
-
|
|
53454
|
-
return ia_ok(vec2(-1.0, 0.0));
|
|
53661
|
+
// Interval spans 0 - discontinuity
|
|
53662
|
+
return ia_singular(0.0);
|
|
53455
53663
|
}
|
|
53456
53664
|
|
|
53457
|
-
// Floor
|
|
53665
|
+
// Floor - has jump discontinuities at every integer
|
|
53458
53666
|
IntervalResult ia_floor(vec2 x) {
|
|
53459
|
-
|
|
53667
|
+
float flo = floor(x.x);
|
|
53668
|
+
float fhi = floor(x.y);
|
|
53669
|
+
if (flo == fhi) {
|
|
53670
|
+
return ia_ok(vec2(flo, fhi));
|
|
53671
|
+
}
|
|
53672
|
+
// Interval spans an integer boundary - discontinuity at first integer > x.x
|
|
53673
|
+
// floor is right-continuous
|
|
53674
|
+
return ia_singular_right(flo + 1.0);
|
|
53460
53675
|
}
|
|
53461
53676
|
|
|
53462
|
-
// Ceiling
|
|
53677
|
+
// Ceiling - has jump discontinuities at every integer
|
|
53463
53678
|
IntervalResult ia_ceil(vec2 x) {
|
|
53464
|
-
|
|
53679
|
+
float clo = ceil(x.x);
|
|
53680
|
+
float chi = ceil(x.y);
|
|
53681
|
+
if (clo == chi) {
|
|
53682
|
+
return ia_ok(vec2(clo, chi));
|
|
53683
|
+
}
|
|
53684
|
+
// Interval spans an integer boundary - discontinuity at ceil(x.x)
|
|
53685
|
+
// ceil is left-continuous
|
|
53686
|
+
return ia_singular_left(clo);
|
|
53687
|
+
}
|
|
53688
|
+
|
|
53689
|
+
// Round - has jump discontinuities at every half-integer
|
|
53690
|
+
// Note: GLSL round() uses IEEE 754 round-half-to-even, while JS Math.round
|
|
53691
|
+
// uses round-half-up. They differ only AT half-integers; discontinuity
|
|
53692
|
+
// detection is safe because intervals spanning half-integers return singular.
|
|
53693
|
+
IntervalResult ia_round(vec2 x) {
|
|
53694
|
+
float rlo = round(x.x);
|
|
53695
|
+
float rhi = round(x.y);
|
|
53696
|
+
if (rlo == rhi) {
|
|
53697
|
+
return ia_ok(vec2(rlo, rhi));
|
|
53698
|
+
}
|
|
53699
|
+
// Interval spans a half-integer boundary - discontinuity
|
|
53700
|
+
// round is right-continuous (with round-half-up convention)
|
|
53701
|
+
return ia_singular_right(rlo + 0.5);
|
|
53702
|
+
}
|
|
53703
|
+
|
|
53704
|
+
// Fract - sawtooth discontinuities at every integer
|
|
53705
|
+
// fract(x) = x - floor(x), jumps from ~1 back to 0 at each integer
|
|
53706
|
+
IntervalResult ia_fract(vec2 x) {
|
|
53707
|
+
float flo = floor(x.x);
|
|
53708
|
+
float fhi = floor(x.y);
|
|
53709
|
+
if (flo == fhi) {
|
|
53710
|
+
// No integer crossing - fract is continuous (linear) on this interval
|
|
53711
|
+
return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
|
|
53712
|
+
}
|
|
53713
|
+
// Interval spans an integer - sawtooth discontinuity
|
|
53714
|
+
// fract is right-continuous (inherits from floor)
|
|
53715
|
+
return ia_singular_right(flo + 1.0);
|
|
53716
|
+
}
|
|
53717
|
+
|
|
53718
|
+
// Mod - periodic discontinuities at multiples of the modulus
|
|
53719
|
+
// mod(x, y) = x - y * floor(x / y)
|
|
53720
|
+
IntervalResult ia_mod(vec2 x, vec2 y) {
|
|
53721
|
+
// y contains zero - undefined
|
|
53722
|
+
if (y.x <= 0.0 && y.y >= 0.0) {
|
|
53723
|
+
return ia_singular(0.0);
|
|
53724
|
+
}
|
|
53725
|
+
|
|
53726
|
+
// Constant modulus (point interval) - common case
|
|
53727
|
+
if (y.x == y.y) {
|
|
53728
|
+
float period = abs(y.x);
|
|
53729
|
+
float flo = floor(x.x / period);
|
|
53730
|
+
float fhi = floor(x.y / period);
|
|
53731
|
+
if (flo == fhi) {
|
|
53732
|
+
// No discontinuity - mod is continuous (linear) on this interval
|
|
53733
|
+
float mlo = x.x - period * flo;
|
|
53734
|
+
float mhi = x.y - period * flo;
|
|
53735
|
+
return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
|
|
53736
|
+
}
|
|
53737
|
+
// Discontinuity at first multiple of period in the interval
|
|
53738
|
+
// mod has sawtooth discontinuities, right-continuous
|
|
53739
|
+
return ia_singular_right((flo + 1.0) * period);
|
|
53740
|
+
}
|
|
53741
|
+
|
|
53742
|
+
// General case: compose from existing operations
|
|
53743
|
+
// Discontinuity detection comes from ia_floor
|
|
53744
|
+
IntervalResult q = ia_div(x, y);
|
|
53745
|
+
if (ia_is_error(q.status)) return q;
|
|
53746
|
+
IntervalResult fq = ia_floor(q.value);
|
|
53747
|
+
if (ia_is_error(fq.status)) return fq;
|
|
53748
|
+
return ia_sub(x, ia_mul_raw(y, fq.value));
|
|
53465
53749
|
}
|
|
53466
53750
|
|
|
53467
53751
|
// Min of two intervals
|
|
@@ -53750,6 +54034,32 @@ IntervalResult ia_ceil(IntervalResult x) {
|
|
|
53750
54034
|
return ia_ceil(x.value);
|
|
53751
54035
|
}
|
|
53752
54036
|
|
|
54037
|
+
IntervalResult ia_round(IntervalResult x) {
|
|
54038
|
+
if (ia_is_error(x.status)) return x;
|
|
54039
|
+
return ia_round(x.value);
|
|
54040
|
+
}
|
|
54041
|
+
|
|
54042
|
+
IntervalResult ia_fract(IntervalResult x) {
|
|
54043
|
+
if (ia_is_error(x.status)) return x;
|
|
54044
|
+
return ia_fract(x.value);
|
|
54045
|
+
}
|
|
54046
|
+
|
|
54047
|
+
IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
|
|
54048
|
+
if (ia_is_error(a.status)) return a;
|
|
54049
|
+
if (ia_is_error(b.status)) return b;
|
|
54050
|
+
return ia_mod(a.value, b.value);
|
|
54051
|
+
}
|
|
54052
|
+
|
|
54053
|
+
IntervalResult ia_mod(IntervalResult a, vec2 b) {
|
|
54054
|
+
if (ia_is_error(a.status)) return a;
|
|
54055
|
+
return ia_mod(a.value, b);
|
|
54056
|
+
}
|
|
54057
|
+
|
|
54058
|
+
IntervalResult ia_mod(vec2 a, IntervalResult b) {
|
|
54059
|
+
if (ia_is_error(b.status)) return b;
|
|
54060
|
+
return ia_mod(a, b.value);
|
|
54061
|
+
}
|
|
54062
|
+
|
|
53753
54063
|
IntervalResult ia_min(IntervalResult a, IntervalResult b) {
|
|
53754
54064
|
if (ia_is_error(a.status)) return a;
|
|
53755
54065
|
if (ia_is_error(b.status)) return b;
|
|
@@ -53831,6 +54141,263 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53831
54141
|
if (ia_is_error(x.status)) return x;
|
|
53832
54142
|
return ia_tanh(x.value);
|
|
53833
54143
|
}
|
|
54144
|
+
|
|
54145
|
+
// Cotangent (derived from cos/sin)
|
|
54146
|
+
IntervalResult ia_cot(vec2 x) {
|
|
54147
|
+
return ia_div(ia_cos(x), ia_sin(x));
|
|
54148
|
+
}
|
|
54149
|
+
|
|
54150
|
+
IntervalResult ia_cot(IntervalResult x) {
|
|
54151
|
+
if (ia_is_error(x.status)) return x;
|
|
54152
|
+
return ia_cot(x.value);
|
|
54153
|
+
}
|
|
54154
|
+
|
|
54155
|
+
// Cosecant (derived from 1/sin)
|
|
54156
|
+
IntervalResult ia_csc(vec2 x) {
|
|
54157
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sin(x));
|
|
54158
|
+
}
|
|
54159
|
+
|
|
54160
|
+
IntervalResult ia_csc(IntervalResult x) {
|
|
54161
|
+
if (ia_is_error(x.status)) return x;
|
|
54162
|
+
return ia_csc(x.value);
|
|
54163
|
+
}
|
|
54164
|
+
|
|
54165
|
+
// Secant (derived from 1/cos)
|
|
54166
|
+
IntervalResult ia_sec(vec2 x) {
|
|
54167
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cos(x));
|
|
54168
|
+
}
|
|
54169
|
+
|
|
54170
|
+
IntervalResult ia_sec(IntervalResult x) {
|
|
54171
|
+
if (ia_is_error(x.status)) return x;
|
|
54172
|
+
return ia_sec(x.value);
|
|
54173
|
+
}
|
|
54174
|
+
|
|
54175
|
+
// Inverse cotangent
|
|
54176
|
+
IntervalResult ia_acot(vec2 x) {
|
|
54177
|
+
return ia_atan(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54178
|
+
}
|
|
54179
|
+
|
|
54180
|
+
IntervalResult ia_acot(IntervalResult x) {
|
|
54181
|
+
if (ia_is_error(x.status)) return x;
|
|
54182
|
+
return ia_acot(x.value);
|
|
54183
|
+
}
|
|
54184
|
+
|
|
54185
|
+
// Inverse cosecant
|
|
54186
|
+
IntervalResult ia_acsc(vec2 x) {
|
|
54187
|
+
return ia_asin(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54188
|
+
}
|
|
54189
|
+
|
|
54190
|
+
IntervalResult ia_acsc(IntervalResult x) {
|
|
54191
|
+
if (ia_is_error(x.status)) return x;
|
|
54192
|
+
return ia_acsc(x.value);
|
|
54193
|
+
}
|
|
54194
|
+
|
|
54195
|
+
// Inverse secant
|
|
54196
|
+
IntervalResult ia_asec(vec2 x) {
|
|
54197
|
+
return ia_acos(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54198
|
+
}
|
|
54199
|
+
|
|
54200
|
+
IntervalResult ia_asec(IntervalResult x) {
|
|
54201
|
+
if (ia_is_error(x.status)) return x;
|
|
54202
|
+
return ia_asec(x.value);
|
|
54203
|
+
}
|
|
54204
|
+
|
|
54205
|
+
// Hyperbolic cotangent
|
|
54206
|
+
IntervalResult ia_coth(vec2 x) {
|
|
54207
|
+
return ia_div(ia_cosh(x), ia_sinh(x));
|
|
54208
|
+
}
|
|
54209
|
+
|
|
54210
|
+
IntervalResult ia_coth(IntervalResult x) {
|
|
54211
|
+
if (ia_is_error(x.status)) return x;
|
|
54212
|
+
return ia_coth(x.value);
|
|
54213
|
+
}
|
|
54214
|
+
|
|
54215
|
+
// Hyperbolic cosecant
|
|
54216
|
+
IntervalResult ia_csch(vec2 x) {
|
|
54217
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sinh(x));
|
|
54218
|
+
}
|
|
54219
|
+
|
|
54220
|
+
IntervalResult ia_csch(IntervalResult x) {
|
|
54221
|
+
if (ia_is_error(x.status)) return x;
|
|
54222
|
+
return ia_csch(x.value);
|
|
54223
|
+
}
|
|
54224
|
+
|
|
54225
|
+
// Hyperbolic secant
|
|
54226
|
+
IntervalResult ia_sech(vec2 x) {
|
|
54227
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cosh(x));
|
|
54228
|
+
}
|
|
54229
|
+
|
|
54230
|
+
IntervalResult ia_sech(IntervalResult x) {
|
|
54231
|
+
if (ia_is_error(x.status)) return x;
|
|
54232
|
+
return ia_sech(x.value);
|
|
54233
|
+
}
|
|
54234
|
+
|
|
54235
|
+
// Inverse hyperbolic sine
|
|
54236
|
+
IntervalResult ia_asinh(vec2 x) {
|
|
54237
|
+
return ia_ok(vec2(asinh(x.x) - IA_EPS, asinh(x.y) + IA_EPS));
|
|
54238
|
+
}
|
|
54239
|
+
|
|
54240
|
+
IntervalResult ia_asinh(IntervalResult x) {
|
|
54241
|
+
if (ia_is_error(x.status)) return x;
|
|
54242
|
+
return ia_asinh(x.value);
|
|
54243
|
+
}
|
|
54244
|
+
|
|
54245
|
+
// Inverse hyperbolic cosine
|
|
54246
|
+
IntervalResult ia_acosh(vec2 x) {
|
|
54247
|
+
if (x.y < 1.0) {
|
|
54248
|
+
return ia_empty();
|
|
54249
|
+
}
|
|
54250
|
+
if (x.x >= 1.0) {
|
|
54251
|
+
return ia_ok(vec2(acosh(x.x) - IA_EPS, acosh(x.y) + IA_EPS));
|
|
54252
|
+
}
|
|
54253
|
+
return ia_partial(vec2(0.0, acosh(x.y) + IA_EPS), IA_PARTIAL_LO);
|
|
54254
|
+
}
|
|
54255
|
+
|
|
54256
|
+
IntervalResult ia_acosh(IntervalResult x) {
|
|
54257
|
+
if (ia_is_error(x.status)) return x;
|
|
54258
|
+
return ia_acosh(x.value);
|
|
54259
|
+
}
|
|
54260
|
+
|
|
54261
|
+
// Inverse hyperbolic tangent
|
|
54262
|
+
IntervalResult ia_atanh(vec2 x) {
|
|
54263
|
+
if (x.x >= 1.0 || x.y <= -1.0) {
|
|
54264
|
+
return ia_empty();
|
|
54265
|
+
}
|
|
54266
|
+
vec2 clipped = vec2(max(x.x, -1.0 + IA_EPS), min(x.y, 1.0 - IA_EPS));
|
|
54267
|
+
if (x.x < -1.0 || x.y > 1.0) {
|
|
54268
|
+
float clip = (x.x < -1.0 && x.y > 1.0) ? IA_PARTIAL_BOTH :
|
|
54269
|
+
(x.x < -1.0) ? IA_PARTIAL_LO : IA_PARTIAL_HI;
|
|
54270
|
+
return ia_partial(vec2(atanh(clipped.x) - IA_EPS, atanh(clipped.y) + IA_EPS), clip);
|
|
54271
|
+
}
|
|
54272
|
+
return ia_ok(vec2(atanh(x.x) - IA_EPS, atanh(x.y) + IA_EPS));
|
|
54273
|
+
}
|
|
54274
|
+
|
|
54275
|
+
IntervalResult ia_atanh(IntervalResult x) {
|
|
54276
|
+
if (ia_is_error(x.status)) return x;
|
|
54277
|
+
return ia_atanh(x.value);
|
|
54278
|
+
}
|
|
54279
|
+
|
|
54280
|
+
// Inverse hyperbolic cotangent
|
|
54281
|
+
IntervalResult ia_acoth(vec2 x) {
|
|
54282
|
+
return ia_atanh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54283
|
+
}
|
|
54284
|
+
|
|
54285
|
+
IntervalResult ia_acoth(IntervalResult x) {
|
|
54286
|
+
if (ia_is_error(x.status)) return x;
|
|
54287
|
+
return ia_acoth(x.value);
|
|
54288
|
+
}
|
|
54289
|
+
|
|
54290
|
+
// Inverse hyperbolic cosecant
|
|
54291
|
+
IntervalResult ia_acsch(vec2 x) {
|
|
54292
|
+
return ia_asinh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54293
|
+
}
|
|
54294
|
+
|
|
54295
|
+
IntervalResult ia_acsch(IntervalResult x) {
|
|
54296
|
+
if (ia_is_error(x.status)) return x;
|
|
54297
|
+
return ia_acsch(x.value);
|
|
54298
|
+
}
|
|
54299
|
+
|
|
54300
|
+
// Inverse hyperbolic secant
|
|
54301
|
+
IntervalResult ia_asech(vec2 x) {
|
|
54302
|
+
return ia_acosh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54303
|
+
}
|
|
54304
|
+
|
|
54305
|
+
IntervalResult ia_asech(IntervalResult x) {
|
|
54306
|
+
if (ia_is_error(x.status)) return x;
|
|
54307
|
+
return ia_asech(x.value);
|
|
54308
|
+
}
|
|
54309
|
+
|
|
54310
|
+
// Boolean interval comparisons
|
|
54311
|
+
// Returns 1.0 = true, 0.0 = false, 0.5 = maybe
|
|
54312
|
+
const float IA_TRUE = 1.0;
|
|
54313
|
+
const float IA_FALSE = 0.0;
|
|
54314
|
+
const float IA_MAYBE = 0.5;
|
|
54315
|
+
|
|
54316
|
+
float ia_less(vec2 a, vec2 b) {
|
|
54317
|
+
if (a.y < b.x) return IA_TRUE;
|
|
54318
|
+
if (a.x >= b.y) return IA_FALSE;
|
|
54319
|
+
return IA_MAYBE;
|
|
54320
|
+
}
|
|
54321
|
+
|
|
54322
|
+
float ia_lessEqual(vec2 a, vec2 b) {
|
|
54323
|
+
if (a.y <= b.x) return IA_TRUE;
|
|
54324
|
+
if (a.x > b.y) return IA_FALSE;
|
|
54325
|
+
return IA_MAYBE;
|
|
54326
|
+
}
|
|
54327
|
+
|
|
54328
|
+
float ia_greater(vec2 a, vec2 b) {
|
|
54329
|
+
if (a.x > b.y) return IA_TRUE;
|
|
54330
|
+
if (a.y <= b.x) return IA_FALSE;
|
|
54331
|
+
return IA_MAYBE;
|
|
54332
|
+
}
|
|
54333
|
+
|
|
54334
|
+
float ia_greaterEqual(vec2 a, vec2 b) {
|
|
54335
|
+
if (a.x >= b.y) return IA_TRUE;
|
|
54336
|
+
if (a.y < b.x) return IA_FALSE;
|
|
54337
|
+
return IA_MAYBE;
|
|
54338
|
+
}
|
|
54339
|
+
|
|
54340
|
+
float ia_equal(vec2 a, vec2 b) {
|
|
54341
|
+
if (a.x == a.y && b.x == b.y && a.x == b.x) return IA_TRUE;
|
|
54342
|
+
if (a.y < b.x || b.y < a.x) return IA_FALSE;
|
|
54343
|
+
return IA_MAYBE;
|
|
54344
|
+
}
|
|
54345
|
+
|
|
54346
|
+
float ia_notEqual(vec2 a, vec2 b) {
|
|
54347
|
+
float eq = ia_equal(a, b);
|
|
54348
|
+
if (eq == IA_TRUE) return IA_FALSE;
|
|
54349
|
+
if (eq == IA_FALSE) return IA_TRUE;
|
|
54350
|
+
return IA_MAYBE;
|
|
54351
|
+
}
|
|
54352
|
+
|
|
54353
|
+
float ia_and(float a, float b) {
|
|
54354
|
+
if (a == IA_FALSE || b == IA_FALSE) return IA_FALSE;
|
|
54355
|
+
if (a == IA_TRUE && b == IA_TRUE) return IA_TRUE;
|
|
54356
|
+
return IA_MAYBE;
|
|
54357
|
+
}
|
|
54358
|
+
|
|
54359
|
+
float ia_or(float a, float b) {
|
|
54360
|
+
if (a == IA_TRUE || b == IA_TRUE) return IA_TRUE;
|
|
54361
|
+
if (a == IA_FALSE && b == IA_FALSE) return IA_FALSE;
|
|
54362
|
+
return IA_MAYBE;
|
|
54363
|
+
}
|
|
54364
|
+
|
|
54365
|
+
float ia_not(float a) {
|
|
54366
|
+
if (a == IA_TRUE) return IA_FALSE;
|
|
54367
|
+
if (a == IA_FALSE) return IA_TRUE;
|
|
54368
|
+
return IA_MAYBE;
|
|
54369
|
+
}
|
|
54370
|
+
|
|
54371
|
+
// IntervalResult overloads for comparisons
|
|
54372
|
+
float ia_less(IntervalResult a, IntervalResult b) {
|
|
54373
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54374
|
+
return ia_less(a.value, b.value);
|
|
54375
|
+
}
|
|
54376
|
+
|
|
54377
|
+
float ia_lessEqual(IntervalResult a, IntervalResult b) {
|
|
54378
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54379
|
+
return ia_lessEqual(a.value, b.value);
|
|
54380
|
+
}
|
|
54381
|
+
|
|
54382
|
+
float ia_greater(IntervalResult a, IntervalResult b) {
|
|
54383
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54384
|
+
return ia_greater(a.value, b.value);
|
|
54385
|
+
}
|
|
54386
|
+
|
|
54387
|
+
float ia_greaterEqual(IntervalResult a, IntervalResult b) {
|
|
54388
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54389
|
+
return ia_greaterEqual(a.value, b.value);
|
|
54390
|
+
}
|
|
54391
|
+
|
|
54392
|
+
float ia_equal(IntervalResult a, IntervalResult b) {
|
|
54393
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54394
|
+
return ia_equal(a.value, b.value);
|
|
54395
|
+
}
|
|
54396
|
+
|
|
54397
|
+
float ia_notEqual(IntervalResult a, IntervalResult b) {
|
|
54398
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54399
|
+
return ia_notEqual(a.value, b.value);
|
|
54400
|
+
}
|
|
53834
54401
|
`;
|
|
53835
54402
|
var INTERVAL_GLSL_OPERATORS = {
|
|
53836
54403
|
Add: ["ia_add", 20],
|
|
@@ -53882,7 +54449,9 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53882
54449
|
Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
|
|
53883
54450
|
Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
|
|
53884
54451
|
Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
|
|
54452
|
+
Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
|
|
53885
54453
|
Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
|
|
54454
|
+
Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
|
|
53886
54455
|
Max: (args, compile) => {
|
|
53887
54456
|
if (args.length === 0) return "ia_point(-1e38)";
|
|
53888
54457
|
if (args.length === 1) return compile(args[0]);
|
|
@@ -53915,6 +54484,7 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53915
54484
|
}
|
|
53916
54485
|
throw new Error("Interval GLSL does not support variable exponents");
|
|
53917
54486
|
},
|
|
54487
|
+
Round: (args, compile) => `ia_round(${compile(args[0])})`,
|
|
53918
54488
|
Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
|
|
53919
54489
|
Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
|
|
53920
54490
|
Square: (args, compile) => `ia_square(${compile(args[0])})`,
|
|
@@ -53925,10 +54495,40 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53925
54495
|
Arcsin: (args, compile) => `ia_asin(${compile(args[0])})`,
|
|
53926
54496
|
Arccos: (args, compile) => `ia_acos(${compile(args[0])})`,
|
|
53927
54497
|
Arctan: (args, compile) => `ia_atan(${compile(args[0])})`,
|
|
54498
|
+
// Reciprocal trigonometric functions
|
|
54499
|
+
Cot: (args, compile) => `ia_cot(${compile(args[0])})`,
|
|
54500
|
+
Csc: (args, compile) => `ia_csc(${compile(args[0])})`,
|
|
54501
|
+
Sec: (args, compile) => `ia_sec(${compile(args[0])})`,
|
|
54502
|
+
// Inverse trigonometric (reciprocal)
|
|
54503
|
+
Arccot: (args, compile) => `ia_acot(${compile(args[0])})`,
|
|
54504
|
+
Arccsc: (args, compile) => `ia_acsc(${compile(args[0])})`,
|
|
54505
|
+
Arcsec: (args, compile) => `ia_asec(${compile(args[0])})`,
|
|
53928
54506
|
// Hyperbolic functions
|
|
53929
54507
|
Sinh: (args, compile) => `ia_sinh(${compile(args[0])})`,
|
|
53930
54508
|
Cosh: (args, compile) => `ia_cosh(${compile(args[0])})`,
|
|
53931
|
-
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})
|
|
54509
|
+
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`,
|
|
54510
|
+
// Reciprocal hyperbolic functions
|
|
54511
|
+
Coth: (args, compile) => `ia_coth(${compile(args[0])})`,
|
|
54512
|
+
Csch: (args, compile) => `ia_csch(${compile(args[0])})`,
|
|
54513
|
+
Sech: (args, compile) => `ia_sech(${compile(args[0])})`,
|
|
54514
|
+
// Inverse hyperbolic functions
|
|
54515
|
+
Arsinh: (args, compile) => `ia_asinh(${compile(args[0])})`,
|
|
54516
|
+
Arcosh: (args, compile) => `ia_acosh(${compile(args[0])})`,
|
|
54517
|
+
Artanh: (args, compile) => `ia_atanh(${compile(args[0])})`,
|
|
54518
|
+
// Inverse hyperbolic (reciprocal)
|
|
54519
|
+
Arcoth: (args, compile) => `ia_acoth(${compile(args[0])})`,
|
|
54520
|
+
Arcsch: (args, compile) => `ia_acsch(${compile(args[0])})`,
|
|
54521
|
+
Arsech: (args, compile) => `ia_asech(${compile(args[0])})`,
|
|
54522
|
+
// Comparison and logic (return float: 1.0=true, 0.0=false, 0.5=maybe)
|
|
54523
|
+
Equal: (args, compile) => `ia_equal(${compile(args[0])}, ${compile(args[1])})`,
|
|
54524
|
+
NotEqual: (args, compile) => `ia_notEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54525
|
+
Less: (args, compile) => `ia_less(${compile(args[0])}, ${compile(args[1])})`,
|
|
54526
|
+
LessEqual: (args, compile) => `ia_lessEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54527
|
+
Greater: (args, compile) => `ia_greater(${compile(args[0])}, ${compile(args[1])})`,
|
|
54528
|
+
GreaterEqual: (args, compile) => `ia_greaterEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54529
|
+
And: (args, compile) => `ia_and(${compile(args[0])}, ${compile(args[1])})`,
|
|
54530
|
+
Or: (args, compile) => `ia_or(${compile(args[0])}, ${compile(args[1])})`,
|
|
54531
|
+
Not: (args, compile) => `ia_not(${compile(args[0])})`
|
|
53932
54532
|
};
|
|
53933
54533
|
var IntervalGLSLTarget = class {
|
|
53934
54534
|
getOperators() {
|
|
@@ -55826,10 +56426,10 @@ IntervalResult ${functionName}(${params}) {
|
|
|
55826
56426
|
// src/compute-engine.ts
|
|
55827
56427
|
init_types6();
|
|
55828
56428
|
init_base_compiler();
|
|
55829
|
-
var version = "0.35.
|
|
56429
|
+
var version = "0.35.4";
|
|
55830
56430
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
55831
56431
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
55832
|
-
version: "0.35.
|
|
56432
|
+
version: "0.35.4"
|
|
55833
56433
|
};
|
|
55834
56434
|
return __toCommonJS(compute_engine_exports);
|
|
55835
56435
|
})();
|