@cortex-js/compute-engine 0.35.2 → 0.35.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compute-engine.esm.js +614 -29
- package/dist/compute-engine.min.esm.js +405 -52
- package/dist/compute-engine.min.umd.js +405 -52
- package/dist/compute-engine.umd.js +614 -29
- 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 +1 -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.3 */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -51485,6 +51485,13 @@ var JAVASCRIPT_FUNCTIONS = {
|
|
|
51485
51485
|
},
|
|
51486
51486
|
Exp: "Math.exp",
|
|
51487
51487
|
Floor: "Math.floor",
|
|
51488
|
+
Fract: ([x], compile) => {
|
|
51489
|
+
if (x === null) throw new Error("Fract: no argument");
|
|
51490
|
+
return BaseCompiler.inlineExpression(
|
|
51491
|
+
"${x} - Math.floor(${x})",
|
|
51492
|
+
compile(x)
|
|
51493
|
+
);
|
|
51494
|
+
},
|
|
51488
51495
|
Gamma: "_SYS.gamma",
|
|
51489
51496
|
GCD: "_SYS.gcd",
|
|
51490
51497
|
Integrate: (args, compile, target) => compileIntegrate(args, compile, target),
|
|
@@ -51918,6 +51925,87 @@ var GLSL_FUNCTIONS = {
|
|
|
51918
51925
|
Sqrt: "sqrt",
|
|
51919
51926
|
Step: "step",
|
|
51920
51927
|
Tan: "tan",
|
|
51928
|
+
// Reciprocal trigonometric functions (no GLSL built-ins)
|
|
51929
|
+
Cot: ([x], compile) => {
|
|
51930
|
+
if (x === null) throw new Error("Cot: no argument");
|
|
51931
|
+
const arg = compile(x);
|
|
51932
|
+
return `(cos(${arg}) / sin(${arg}))`;
|
|
51933
|
+
},
|
|
51934
|
+
Csc: ([x], compile) => {
|
|
51935
|
+
if (x === null) throw new Error("Csc: no argument");
|
|
51936
|
+
return `(1.0 / sin(${compile(x)}))`;
|
|
51937
|
+
},
|
|
51938
|
+
Sec: ([x], compile) => {
|
|
51939
|
+
if (x === null) throw new Error("Sec: no argument");
|
|
51940
|
+
return `(1.0 / cos(${compile(x)}))`;
|
|
51941
|
+
},
|
|
51942
|
+
// Inverse trigonometric (reciprocal)
|
|
51943
|
+
Arccot: ([x], compile) => {
|
|
51944
|
+
if (x === null) throw new Error("Arccot: no argument");
|
|
51945
|
+
return `atan(1.0 / (${compile(x)}))`;
|
|
51946
|
+
},
|
|
51947
|
+
Arccsc: ([x], compile) => {
|
|
51948
|
+
if (x === null) throw new Error("Arccsc: no argument");
|
|
51949
|
+
return `asin(1.0 / (${compile(x)}))`;
|
|
51950
|
+
},
|
|
51951
|
+
Arcsec: ([x], compile) => {
|
|
51952
|
+
if (x === null) throw new Error("Arcsec: no argument");
|
|
51953
|
+
return `acos(1.0 / (${compile(x)}))`;
|
|
51954
|
+
},
|
|
51955
|
+
// Hyperbolic functions (GLSL ES 3.0+ built-ins)
|
|
51956
|
+
Sinh: "sinh",
|
|
51957
|
+
Cosh: "cosh",
|
|
51958
|
+
Tanh: "tanh",
|
|
51959
|
+
// Reciprocal hyperbolic functions
|
|
51960
|
+
Coth: ([x], compile) => {
|
|
51961
|
+
if (x === null) throw new Error("Coth: no argument");
|
|
51962
|
+
const arg = compile(x);
|
|
51963
|
+
return `(cosh(${arg}) / sinh(${arg}))`;
|
|
51964
|
+
},
|
|
51965
|
+
Csch: ([x], compile) => {
|
|
51966
|
+
if (x === null) throw new Error("Csch: no argument");
|
|
51967
|
+
return `(1.0 / sinh(${compile(x)}))`;
|
|
51968
|
+
},
|
|
51969
|
+
Sech: ([x], compile) => {
|
|
51970
|
+
if (x === null) throw new Error("Sech: no argument");
|
|
51971
|
+
return `(1.0 / cosh(${compile(x)}))`;
|
|
51972
|
+
},
|
|
51973
|
+
// Inverse hyperbolic functions (GLSL ES 3.0+ built-ins)
|
|
51974
|
+
Arcosh: "acosh",
|
|
51975
|
+
Arsinh: "asinh",
|
|
51976
|
+
Artanh: "atanh",
|
|
51977
|
+
// Inverse hyperbolic (reciprocal)
|
|
51978
|
+
Arcoth: ([x], compile) => {
|
|
51979
|
+
if (x === null) throw new Error("Arcoth: no argument");
|
|
51980
|
+
return `atanh(1.0 / (${compile(x)}))`;
|
|
51981
|
+
},
|
|
51982
|
+
Arcsch: ([x], compile) => {
|
|
51983
|
+
if (x === null) throw new Error("Arcsch: no argument");
|
|
51984
|
+
return `asinh(1.0 / (${compile(x)}))`;
|
|
51985
|
+
},
|
|
51986
|
+
Arsech: ([x], compile) => {
|
|
51987
|
+
if (x === null) throw new Error("Arsech: no argument");
|
|
51988
|
+
return `acosh(1.0 / (${compile(x)}))`;
|
|
51989
|
+
},
|
|
51990
|
+
// Additional math functions
|
|
51991
|
+
Sgn: "sign",
|
|
51992
|
+
Lb: "log2",
|
|
51993
|
+
Log: (args, compile) => {
|
|
51994
|
+
if (args.length === 0) throw new Error("Log: no argument");
|
|
51995
|
+
if (args.length === 1) return `(log(${compile(args[0])}) / log(10.0))`;
|
|
51996
|
+
return `(log(${compile(args[0])}) / log(${compile(args[1])}))`;
|
|
51997
|
+
},
|
|
51998
|
+
Square: ([x], compile) => {
|
|
51999
|
+
if (x === null) throw new Error("Square: no argument");
|
|
52000
|
+
const arg = compile(x);
|
|
52001
|
+
return `(${arg} * ${arg})`;
|
|
52002
|
+
},
|
|
52003
|
+
Root: ([x, n], compile) => {
|
|
52004
|
+
if (x === null) throw new Error("Root: no argument");
|
|
52005
|
+
if (n === null || n === void 0) return `sqrt(${compile(x)})`;
|
|
52006
|
+
if (n?.re === 2) return `sqrt(${compile(x)})`;
|
|
52007
|
+
return `pow(${compile(x)}, 1.0 / ${compile(n)})`;
|
|
52008
|
+
},
|
|
51921
52009
|
// Vector/Matrix operations
|
|
51922
52010
|
Cross: "cross",
|
|
51923
52011
|
Distance: "distance",
|
|
@@ -52464,19 +52552,39 @@ function floor2(x) {
|
|
|
52464
52552
|
const unwrapped = unwrapOrPropagate(x);
|
|
52465
52553
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52466
52554
|
const [xVal] = unwrapped;
|
|
52467
|
-
|
|
52555
|
+
const flo = Math.floor(xVal.lo);
|
|
52556
|
+
const fhi = Math.floor(xVal.hi);
|
|
52557
|
+
if (flo === fhi) return ok({ lo: flo, hi: fhi });
|
|
52558
|
+
return { kind: "singular", at: flo + 1 };
|
|
52468
52559
|
}
|
|
52469
52560
|
function ceil2(x) {
|
|
52470
52561
|
const unwrapped = unwrapOrPropagate(x);
|
|
52471
52562
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52472
52563
|
const [xVal] = unwrapped;
|
|
52473
|
-
|
|
52564
|
+
const clo = Math.ceil(xVal.lo);
|
|
52565
|
+
const chi = Math.ceil(xVal.hi);
|
|
52566
|
+
if (clo === chi) return ok({ lo: clo, hi: chi });
|
|
52567
|
+
return { kind: "singular", at: clo };
|
|
52474
52568
|
}
|
|
52475
52569
|
function round2(x) {
|
|
52476
52570
|
const unwrapped = unwrapOrPropagate(x);
|
|
52477
52571
|
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52478
52572
|
const [xVal] = unwrapped;
|
|
52479
|
-
|
|
52573
|
+
const rlo = Math.round(xVal.lo);
|
|
52574
|
+
const rhi = Math.round(xVal.hi);
|
|
52575
|
+
if (rlo === rhi) return ok({ lo: rlo, hi: rhi });
|
|
52576
|
+
return { kind: "singular", at: rlo + 0.5 };
|
|
52577
|
+
}
|
|
52578
|
+
function fract(x) {
|
|
52579
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52580
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52581
|
+
const [xVal] = unwrapped;
|
|
52582
|
+
const flo = Math.floor(xVal.lo);
|
|
52583
|
+
const fhi = Math.floor(xVal.hi);
|
|
52584
|
+
if (flo === fhi) {
|
|
52585
|
+
return ok({ lo: xVal.lo - flo, hi: xVal.hi - flo });
|
|
52586
|
+
}
|
|
52587
|
+
return { kind: "singular", at: flo + 1 };
|
|
52480
52588
|
}
|
|
52481
52589
|
function min2(a, b) {
|
|
52482
52590
|
const unwrapped = unwrapOrPropagate(a, b);
|
|
@@ -52503,18 +52611,15 @@ function mod2(a, b) {
|
|
|
52503
52611
|
if (containsZero(bVal)) {
|
|
52504
52612
|
return { kind: "singular" };
|
|
52505
52613
|
}
|
|
52506
|
-
const
|
|
52507
|
-
const
|
|
52508
|
-
|
|
52509
|
-
|
|
52510
|
-
|
|
52511
|
-
const modLo = (aVal.lo % bAbs + bAbs) % bAbs;
|
|
52512
|
-
const modHi = (aVal.hi % bAbs + bAbs) % bAbs;
|
|
52513
|
-
if (modLo <= modHi) {
|
|
52514
|
-
return ok({ lo: modLo, hi: modHi });
|
|
52515
|
-
} else {
|
|
52516
|
-
return ok({ lo: 0, hi: bAbs });
|
|
52614
|
+
const period = Math.abs(bVal.lo === bVal.hi ? bVal.lo : Math.max(Math.abs(bVal.lo), Math.abs(bVal.hi)));
|
|
52615
|
+
const flo = Math.floor(aVal.lo / period);
|
|
52616
|
+
const fhi = Math.floor(aVal.hi / period);
|
|
52617
|
+
if (flo !== fhi) {
|
|
52618
|
+
return { kind: "singular", at: (flo + 1) * period };
|
|
52517
52619
|
}
|
|
52620
|
+
const modLo = aVal.lo - period * flo;
|
|
52621
|
+
const modHi = aVal.hi - period * flo;
|
|
52622
|
+
return ok({ lo: Math.min(modLo, modHi), hi: Math.max(modLo, modHi) });
|
|
52518
52623
|
}
|
|
52519
52624
|
function sign2(x) {
|
|
52520
52625
|
const unwrapped = unwrapOrPropagate(x);
|
|
@@ -52523,9 +52628,7 @@ function sign2(x) {
|
|
|
52523
52628
|
if (xVal.lo > 0) return ok({ lo: 1, hi: 1 });
|
|
52524
52629
|
if (xVal.hi < 0) return ok({ lo: -1, hi: -1 });
|
|
52525
52630
|
if (xVal.lo === 0 && xVal.hi === 0) return ok({ lo: 0, hi: 0 });
|
|
52526
|
-
|
|
52527
|
-
if (xVal.lo === 0) return ok({ lo: 0, hi: 1 });
|
|
52528
|
-
return ok({ lo: -1, hi: 0 });
|
|
52631
|
+
return { kind: "singular", at: 0 };
|
|
52529
52632
|
}
|
|
52530
52633
|
|
|
52531
52634
|
// src/compute-engine/interval/trigonometric.ts
|
|
@@ -52785,6 +52888,81 @@ function atanh2(x) {
|
|
|
52785
52888
|
}
|
|
52786
52889
|
return ok({ lo: Math.atanh(xVal.lo), hi: Math.atanh(xVal.hi) });
|
|
52787
52890
|
}
|
|
52891
|
+
function acot(x) {
|
|
52892
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52893
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52894
|
+
const [xVal] = unwrapped;
|
|
52895
|
+
if (containsZero(xVal)) {
|
|
52896
|
+
return { kind: "singular", at: 0 };
|
|
52897
|
+
}
|
|
52898
|
+
return atan3(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52899
|
+
}
|
|
52900
|
+
function acsc(x) {
|
|
52901
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52902
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52903
|
+
const [xVal] = unwrapped;
|
|
52904
|
+
if (containsZero(xVal)) {
|
|
52905
|
+
return { kind: "singular", at: 0 };
|
|
52906
|
+
}
|
|
52907
|
+
return asin2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52908
|
+
}
|
|
52909
|
+
function asec(x) {
|
|
52910
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52911
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52912
|
+
const [xVal] = unwrapped;
|
|
52913
|
+
if (containsZero(xVal)) {
|
|
52914
|
+
return { kind: "singular", at: 0 };
|
|
52915
|
+
}
|
|
52916
|
+
return acos2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52917
|
+
}
|
|
52918
|
+
function coth(x) {
|
|
52919
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52920
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52921
|
+
const [xVal] = unwrapped;
|
|
52922
|
+
if (containsZero(xVal)) {
|
|
52923
|
+
return { kind: "singular", at: 0 };
|
|
52924
|
+
}
|
|
52925
|
+
return div3(cosh3(xVal), sinh3(xVal));
|
|
52926
|
+
}
|
|
52927
|
+
function csch(x) {
|
|
52928
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52929
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52930
|
+
const [xVal] = unwrapped;
|
|
52931
|
+
if (containsZero(xVal)) {
|
|
52932
|
+
return { kind: "singular", at: 0 };
|
|
52933
|
+
}
|
|
52934
|
+
return div3(ok({ lo: 1, hi: 1 }), sinh3(xVal));
|
|
52935
|
+
}
|
|
52936
|
+
function sech(x) {
|
|
52937
|
+
return div3(ok({ lo: 1, hi: 1 }), cosh3(x));
|
|
52938
|
+
}
|
|
52939
|
+
function acoth(x) {
|
|
52940
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52941
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52942
|
+
const [xVal] = unwrapped;
|
|
52943
|
+
if (containsZero(xVal)) {
|
|
52944
|
+
return { kind: "singular", at: 0 };
|
|
52945
|
+
}
|
|
52946
|
+
return atanh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52947
|
+
}
|
|
52948
|
+
function acsch(x) {
|
|
52949
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52950
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52951
|
+
const [xVal] = unwrapped;
|
|
52952
|
+
if (containsZero(xVal)) {
|
|
52953
|
+
return { kind: "singular", at: 0 };
|
|
52954
|
+
}
|
|
52955
|
+
return asinh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52956
|
+
}
|
|
52957
|
+
function asech(x) {
|
|
52958
|
+
const unwrapped = unwrapOrPropagate(x);
|
|
52959
|
+
if (!Array.isArray(unwrapped)) return unwrapped;
|
|
52960
|
+
const [xVal] = unwrapped;
|
|
52961
|
+
if (containsZero(xVal)) {
|
|
52962
|
+
return { kind: "singular", at: 0 };
|
|
52963
|
+
}
|
|
52964
|
+
return acosh2(div3(ok({ lo: 1, hi: 1 }), ok(xVal)));
|
|
52965
|
+
}
|
|
52788
52966
|
|
|
52789
52967
|
// src/compute-engine/interval/comparison.ts
|
|
52790
52968
|
function less(a, b) {
|
|
@@ -52932,6 +53110,7 @@ var IntervalArithmetic = {
|
|
|
52932
53110
|
floor: floor2,
|
|
52933
53111
|
ceil: ceil2,
|
|
52934
53112
|
round: round2,
|
|
53113
|
+
fract,
|
|
52935
53114
|
min: min2,
|
|
52936
53115
|
max: max2,
|
|
52937
53116
|
mod: mod2,
|
|
@@ -52953,6 +53132,15 @@ var IntervalArithmetic = {
|
|
|
52953
53132
|
asinh: asinh2,
|
|
52954
53133
|
acosh: acosh2,
|
|
52955
53134
|
atanh: atanh2,
|
|
53135
|
+
acot,
|
|
53136
|
+
acsc,
|
|
53137
|
+
asec,
|
|
53138
|
+
coth,
|
|
53139
|
+
csch,
|
|
53140
|
+
sech,
|
|
53141
|
+
acoth,
|
|
53142
|
+
acsch,
|
|
53143
|
+
asech,
|
|
52956
53144
|
// Comparison
|
|
52957
53145
|
less,
|
|
52958
53146
|
lessEqual,
|
|
@@ -53097,17 +53285,28 @@ var INTERVAL_JAVASCRIPT_FUNCTIONS = {
|
|
|
53097
53285
|
Arcsin: (args, compile) => `_IA.asin(${compile(args[0])})`,
|
|
53098
53286
|
Arccos: (args, compile) => `_IA.acos(${compile(args[0])})`,
|
|
53099
53287
|
Arctan: (args, compile) => `_IA.atan(${compile(args[0])})`,
|
|
53288
|
+
Arccot: (args, compile) => `_IA.acot(${compile(args[0])})`,
|
|
53289
|
+
Arccsc: (args, compile) => `_IA.acsc(${compile(args[0])})`,
|
|
53290
|
+
Arcsec: (args, compile) => `_IA.asec(${compile(args[0])})`,
|
|
53100
53291
|
// Hyperbolic functions
|
|
53101
53292
|
Sinh: (args, compile) => `_IA.sinh(${compile(args[0])})`,
|
|
53102
53293
|
Cosh: (args, compile) => `_IA.cosh(${compile(args[0])})`,
|
|
53103
53294
|
Tanh: (args, compile) => `_IA.tanh(${compile(args[0])})`,
|
|
53295
|
+
Coth: (args, compile) => `_IA.coth(${compile(args[0])})`,
|
|
53296
|
+
Csch: (args, compile) => `_IA.csch(${compile(args[0])})`,
|
|
53297
|
+
Sech: (args, compile) => `_IA.sech(${compile(args[0])})`,
|
|
53104
53298
|
Arsinh: (args, compile) => `_IA.asinh(${compile(args[0])})`,
|
|
53105
53299
|
Arcosh: (args, compile) => `_IA.acosh(${compile(args[0])})`,
|
|
53106
53300
|
Artanh: (args, compile) => `_IA.atanh(${compile(args[0])})`,
|
|
53301
|
+
Arcoth: (args, compile) => `_IA.acoth(${compile(args[0])})`,
|
|
53302
|
+
Arcsch: (args, compile) => `_IA.acsch(${compile(args[0])})`,
|
|
53303
|
+
Arsech: (args, compile) => `_IA.asech(${compile(args[0])})`,
|
|
53107
53304
|
// Inverse trig (alternative names)
|
|
53108
53305
|
Asin: (args, compile) => `_IA.asin(${compile(args[0])})`,
|
|
53109
53306
|
Acos: (args, compile) => `_IA.acos(${compile(args[0])})`,
|
|
53110
53307
|
Atan: (args, compile) => `_IA.atan(${compile(args[0])})`,
|
|
53308
|
+
// Elementary
|
|
53309
|
+
Fract: (args, compile) => `_IA.fract(${compile(args[0])})`,
|
|
53111
53310
|
// Mod
|
|
53112
53311
|
Mod: (args, compile) => `_IA.mod(${compile(args[0])}, ${compile(args[1])})`,
|
|
53113
53312
|
// Conditionals
|
|
@@ -53430,24 +53629,94 @@ IntervalResult ia_abs(vec2 x) {
|
|
|
53430
53629
|
return ia_ok(vec2(0.0, max(-x.x, x.y)));
|
|
53431
53630
|
}
|
|
53432
53631
|
|
|
53433
|
-
// Sign function
|
|
53632
|
+
// Sign function - has jump discontinuity at 0
|
|
53434
53633
|
IntervalResult ia_sign(vec2 x) {
|
|
53435
53634
|
if (x.x > 0.0) return ia_ok(vec2(1.0, 1.0));
|
|
53436
53635
|
if (x.y < 0.0) return ia_ok(vec2(-1.0, -1.0));
|
|
53437
53636
|
if (x.x == 0.0 && x.y == 0.0) return ia_ok(vec2(0.0, 0.0));
|
|
53438
|
-
|
|
53439
|
-
|
|
53440
|
-
return ia_ok(vec2(-1.0, 0.0));
|
|
53637
|
+
// Interval spans 0 - discontinuity
|
|
53638
|
+
return ia_singular(0.0);
|
|
53441
53639
|
}
|
|
53442
53640
|
|
|
53443
|
-
// Floor
|
|
53641
|
+
// Floor - has jump discontinuities at every integer
|
|
53444
53642
|
IntervalResult ia_floor(vec2 x) {
|
|
53445
|
-
|
|
53643
|
+
float flo = floor(x.x);
|
|
53644
|
+
float fhi = floor(x.y);
|
|
53645
|
+
if (flo == fhi) {
|
|
53646
|
+
return ia_ok(vec2(flo, fhi));
|
|
53647
|
+
}
|
|
53648
|
+
// Interval spans an integer boundary - discontinuity at first integer > x.x
|
|
53649
|
+
return ia_singular(flo + 1.0);
|
|
53446
53650
|
}
|
|
53447
53651
|
|
|
53448
|
-
// Ceiling
|
|
53652
|
+
// Ceiling - has jump discontinuities at every integer
|
|
53449
53653
|
IntervalResult ia_ceil(vec2 x) {
|
|
53450
|
-
|
|
53654
|
+
float clo = ceil(x.x);
|
|
53655
|
+
float chi = ceil(x.y);
|
|
53656
|
+
if (clo == chi) {
|
|
53657
|
+
return ia_ok(vec2(clo, chi));
|
|
53658
|
+
}
|
|
53659
|
+
// Interval spans an integer boundary - discontinuity at ceil(x.x)
|
|
53660
|
+
return ia_singular(clo);
|
|
53661
|
+
}
|
|
53662
|
+
|
|
53663
|
+
// Round - has jump discontinuities at every half-integer
|
|
53664
|
+
// Note: GLSL round() uses IEEE 754 round-half-to-even, while JS Math.round
|
|
53665
|
+
// uses round-half-up. They differ only AT half-integers; discontinuity
|
|
53666
|
+
// detection is safe because intervals spanning half-integers return singular.
|
|
53667
|
+
IntervalResult ia_round(vec2 x) {
|
|
53668
|
+
float rlo = round(x.x);
|
|
53669
|
+
float rhi = round(x.y);
|
|
53670
|
+
if (rlo == rhi) {
|
|
53671
|
+
return ia_ok(vec2(rlo, rhi));
|
|
53672
|
+
}
|
|
53673
|
+
// Interval spans a half-integer boundary - discontinuity
|
|
53674
|
+
return ia_singular(rlo + 0.5);
|
|
53675
|
+
}
|
|
53676
|
+
|
|
53677
|
+
// Fract - sawtooth discontinuities at every integer
|
|
53678
|
+
// fract(x) = x - floor(x), jumps from ~1 back to 0 at each integer
|
|
53679
|
+
IntervalResult ia_fract(vec2 x) {
|
|
53680
|
+
float flo = floor(x.x);
|
|
53681
|
+
float fhi = floor(x.y);
|
|
53682
|
+
if (flo == fhi) {
|
|
53683
|
+
// No integer crossing - fract is continuous (linear) on this interval
|
|
53684
|
+
return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
|
|
53685
|
+
}
|
|
53686
|
+
// Interval spans an integer - sawtooth discontinuity
|
|
53687
|
+
return ia_singular(flo + 1.0);
|
|
53688
|
+
}
|
|
53689
|
+
|
|
53690
|
+
// Mod - periodic discontinuities at multiples of the modulus
|
|
53691
|
+
// mod(x, y) = x - y * floor(x / y)
|
|
53692
|
+
IntervalResult ia_mod(vec2 x, vec2 y) {
|
|
53693
|
+
// y contains zero - undefined
|
|
53694
|
+
if (y.x <= 0.0 && y.y >= 0.0) {
|
|
53695
|
+
return ia_singular(0.0);
|
|
53696
|
+
}
|
|
53697
|
+
|
|
53698
|
+
// Constant modulus (point interval) - common case
|
|
53699
|
+
if (y.x == y.y) {
|
|
53700
|
+
float period = abs(y.x);
|
|
53701
|
+
float flo = floor(x.x / period);
|
|
53702
|
+
float fhi = floor(x.y / period);
|
|
53703
|
+
if (flo == fhi) {
|
|
53704
|
+
// No discontinuity - mod is continuous (linear) on this interval
|
|
53705
|
+
float mlo = x.x - period * flo;
|
|
53706
|
+
float mhi = x.y - period * flo;
|
|
53707
|
+
return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
|
|
53708
|
+
}
|
|
53709
|
+
// Discontinuity at first multiple of period in the interval
|
|
53710
|
+
return ia_singular((flo + 1.0) * period);
|
|
53711
|
+
}
|
|
53712
|
+
|
|
53713
|
+
// General case: compose from existing operations
|
|
53714
|
+
// Discontinuity detection comes from ia_floor
|
|
53715
|
+
IntervalResult q = ia_div(x, y);
|
|
53716
|
+
if (ia_is_error(q.status)) return q;
|
|
53717
|
+
IntervalResult fq = ia_floor(q.value);
|
|
53718
|
+
if (ia_is_error(fq.status)) return fq;
|
|
53719
|
+
return ia_sub(x, ia_mul_raw(y, fq.value));
|
|
53451
53720
|
}
|
|
53452
53721
|
|
|
53453
53722
|
// Min of two intervals
|
|
@@ -53736,6 +54005,32 @@ IntervalResult ia_ceil(IntervalResult x) {
|
|
|
53736
54005
|
return ia_ceil(x.value);
|
|
53737
54006
|
}
|
|
53738
54007
|
|
|
54008
|
+
IntervalResult ia_round(IntervalResult x) {
|
|
54009
|
+
if (ia_is_error(x.status)) return x;
|
|
54010
|
+
return ia_round(x.value);
|
|
54011
|
+
}
|
|
54012
|
+
|
|
54013
|
+
IntervalResult ia_fract(IntervalResult x) {
|
|
54014
|
+
if (ia_is_error(x.status)) return x;
|
|
54015
|
+
return ia_fract(x.value);
|
|
54016
|
+
}
|
|
54017
|
+
|
|
54018
|
+
IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
|
|
54019
|
+
if (ia_is_error(a.status)) return a;
|
|
54020
|
+
if (ia_is_error(b.status)) return b;
|
|
54021
|
+
return ia_mod(a.value, b.value);
|
|
54022
|
+
}
|
|
54023
|
+
|
|
54024
|
+
IntervalResult ia_mod(IntervalResult a, vec2 b) {
|
|
54025
|
+
if (ia_is_error(a.status)) return a;
|
|
54026
|
+
return ia_mod(a.value, b);
|
|
54027
|
+
}
|
|
54028
|
+
|
|
54029
|
+
IntervalResult ia_mod(vec2 a, IntervalResult b) {
|
|
54030
|
+
if (ia_is_error(b.status)) return b;
|
|
54031
|
+
return ia_mod(a, b.value);
|
|
54032
|
+
}
|
|
54033
|
+
|
|
53739
54034
|
IntervalResult ia_min(IntervalResult a, IntervalResult b) {
|
|
53740
54035
|
if (ia_is_error(a.status)) return a;
|
|
53741
54036
|
if (ia_is_error(b.status)) return b;
|
|
@@ -53817,6 +54112,263 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53817
54112
|
if (ia_is_error(x.status)) return x;
|
|
53818
54113
|
return ia_tanh(x.value);
|
|
53819
54114
|
}
|
|
54115
|
+
|
|
54116
|
+
// Cotangent (derived from cos/sin)
|
|
54117
|
+
IntervalResult ia_cot(vec2 x) {
|
|
54118
|
+
return ia_div(ia_cos(x), ia_sin(x));
|
|
54119
|
+
}
|
|
54120
|
+
|
|
54121
|
+
IntervalResult ia_cot(IntervalResult x) {
|
|
54122
|
+
if (ia_is_error(x.status)) return x;
|
|
54123
|
+
return ia_cot(x.value);
|
|
54124
|
+
}
|
|
54125
|
+
|
|
54126
|
+
// Cosecant (derived from 1/sin)
|
|
54127
|
+
IntervalResult ia_csc(vec2 x) {
|
|
54128
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sin(x));
|
|
54129
|
+
}
|
|
54130
|
+
|
|
54131
|
+
IntervalResult ia_csc(IntervalResult x) {
|
|
54132
|
+
if (ia_is_error(x.status)) return x;
|
|
54133
|
+
return ia_csc(x.value);
|
|
54134
|
+
}
|
|
54135
|
+
|
|
54136
|
+
// Secant (derived from 1/cos)
|
|
54137
|
+
IntervalResult ia_sec(vec2 x) {
|
|
54138
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cos(x));
|
|
54139
|
+
}
|
|
54140
|
+
|
|
54141
|
+
IntervalResult ia_sec(IntervalResult x) {
|
|
54142
|
+
if (ia_is_error(x.status)) return x;
|
|
54143
|
+
return ia_sec(x.value);
|
|
54144
|
+
}
|
|
54145
|
+
|
|
54146
|
+
// Inverse cotangent
|
|
54147
|
+
IntervalResult ia_acot(vec2 x) {
|
|
54148
|
+
return ia_atan(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54149
|
+
}
|
|
54150
|
+
|
|
54151
|
+
IntervalResult ia_acot(IntervalResult x) {
|
|
54152
|
+
if (ia_is_error(x.status)) return x;
|
|
54153
|
+
return ia_acot(x.value);
|
|
54154
|
+
}
|
|
54155
|
+
|
|
54156
|
+
// Inverse cosecant
|
|
54157
|
+
IntervalResult ia_acsc(vec2 x) {
|
|
54158
|
+
return ia_asin(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54159
|
+
}
|
|
54160
|
+
|
|
54161
|
+
IntervalResult ia_acsc(IntervalResult x) {
|
|
54162
|
+
if (ia_is_error(x.status)) return x;
|
|
54163
|
+
return ia_acsc(x.value);
|
|
54164
|
+
}
|
|
54165
|
+
|
|
54166
|
+
// Inverse secant
|
|
54167
|
+
IntervalResult ia_asec(vec2 x) {
|
|
54168
|
+
return ia_acos(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54169
|
+
}
|
|
54170
|
+
|
|
54171
|
+
IntervalResult ia_asec(IntervalResult x) {
|
|
54172
|
+
if (ia_is_error(x.status)) return x;
|
|
54173
|
+
return ia_asec(x.value);
|
|
54174
|
+
}
|
|
54175
|
+
|
|
54176
|
+
// Hyperbolic cotangent
|
|
54177
|
+
IntervalResult ia_coth(vec2 x) {
|
|
54178
|
+
return ia_div(ia_cosh(x), ia_sinh(x));
|
|
54179
|
+
}
|
|
54180
|
+
|
|
54181
|
+
IntervalResult ia_coth(IntervalResult x) {
|
|
54182
|
+
if (ia_is_error(x.status)) return x;
|
|
54183
|
+
return ia_coth(x.value);
|
|
54184
|
+
}
|
|
54185
|
+
|
|
54186
|
+
// Hyperbolic cosecant
|
|
54187
|
+
IntervalResult ia_csch(vec2 x) {
|
|
54188
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sinh(x));
|
|
54189
|
+
}
|
|
54190
|
+
|
|
54191
|
+
IntervalResult ia_csch(IntervalResult x) {
|
|
54192
|
+
if (ia_is_error(x.status)) return x;
|
|
54193
|
+
return ia_csch(x.value);
|
|
54194
|
+
}
|
|
54195
|
+
|
|
54196
|
+
// Hyperbolic secant
|
|
54197
|
+
IntervalResult ia_sech(vec2 x) {
|
|
54198
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cosh(x));
|
|
54199
|
+
}
|
|
54200
|
+
|
|
54201
|
+
IntervalResult ia_sech(IntervalResult x) {
|
|
54202
|
+
if (ia_is_error(x.status)) return x;
|
|
54203
|
+
return ia_sech(x.value);
|
|
54204
|
+
}
|
|
54205
|
+
|
|
54206
|
+
// Inverse hyperbolic sine
|
|
54207
|
+
IntervalResult ia_asinh(vec2 x) {
|
|
54208
|
+
return ia_ok(vec2(asinh(x.x) - IA_EPS, asinh(x.y) + IA_EPS));
|
|
54209
|
+
}
|
|
54210
|
+
|
|
54211
|
+
IntervalResult ia_asinh(IntervalResult x) {
|
|
54212
|
+
if (ia_is_error(x.status)) return x;
|
|
54213
|
+
return ia_asinh(x.value);
|
|
54214
|
+
}
|
|
54215
|
+
|
|
54216
|
+
// Inverse hyperbolic cosine
|
|
54217
|
+
IntervalResult ia_acosh(vec2 x) {
|
|
54218
|
+
if (x.y < 1.0) {
|
|
54219
|
+
return ia_empty();
|
|
54220
|
+
}
|
|
54221
|
+
if (x.x >= 1.0) {
|
|
54222
|
+
return ia_ok(vec2(acosh(x.x) - IA_EPS, acosh(x.y) + IA_EPS));
|
|
54223
|
+
}
|
|
54224
|
+
return ia_partial(vec2(0.0, acosh(x.y) + IA_EPS), IA_PARTIAL_LO);
|
|
54225
|
+
}
|
|
54226
|
+
|
|
54227
|
+
IntervalResult ia_acosh(IntervalResult x) {
|
|
54228
|
+
if (ia_is_error(x.status)) return x;
|
|
54229
|
+
return ia_acosh(x.value);
|
|
54230
|
+
}
|
|
54231
|
+
|
|
54232
|
+
// Inverse hyperbolic tangent
|
|
54233
|
+
IntervalResult ia_atanh(vec2 x) {
|
|
54234
|
+
if (x.x >= 1.0 || x.y <= -1.0) {
|
|
54235
|
+
return ia_empty();
|
|
54236
|
+
}
|
|
54237
|
+
vec2 clipped = vec2(max(x.x, -1.0 + IA_EPS), min(x.y, 1.0 - IA_EPS));
|
|
54238
|
+
if (x.x < -1.0 || x.y > 1.0) {
|
|
54239
|
+
float clip = (x.x < -1.0 && x.y > 1.0) ? IA_PARTIAL_BOTH :
|
|
54240
|
+
(x.x < -1.0) ? IA_PARTIAL_LO : IA_PARTIAL_HI;
|
|
54241
|
+
return ia_partial(vec2(atanh(clipped.x) - IA_EPS, atanh(clipped.y) + IA_EPS), clip);
|
|
54242
|
+
}
|
|
54243
|
+
return ia_ok(vec2(atanh(x.x) - IA_EPS, atanh(x.y) + IA_EPS));
|
|
54244
|
+
}
|
|
54245
|
+
|
|
54246
|
+
IntervalResult ia_atanh(IntervalResult x) {
|
|
54247
|
+
if (ia_is_error(x.status)) return x;
|
|
54248
|
+
return ia_atanh(x.value);
|
|
54249
|
+
}
|
|
54250
|
+
|
|
54251
|
+
// Inverse hyperbolic cotangent
|
|
54252
|
+
IntervalResult ia_acoth(vec2 x) {
|
|
54253
|
+
return ia_atanh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54254
|
+
}
|
|
54255
|
+
|
|
54256
|
+
IntervalResult ia_acoth(IntervalResult x) {
|
|
54257
|
+
if (ia_is_error(x.status)) return x;
|
|
54258
|
+
return ia_acoth(x.value);
|
|
54259
|
+
}
|
|
54260
|
+
|
|
54261
|
+
// Inverse hyperbolic cosecant
|
|
54262
|
+
IntervalResult ia_acsch(vec2 x) {
|
|
54263
|
+
return ia_asinh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54264
|
+
}
|
|
54265
|
+
|
|
54266
|
+
IntervalResult ia_acsch(IntervalResult x) {
|
|
54267
|
+
if (ia_is_error(x.status)) return x;
|
|
54268
|
+
return ia_acsch(x.value);
|
|
54269
|
+
}
|
|
54270
|
+
|
|
54271
|
+
// Inverse hyperbolic secant
|
|
54272
|
+
IntervalResult ia_asech(vec2 x) {
|
|
54273
|
+
return ia_acosh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54274
|
+
}
|
|
54275
|
+
|
|
54276
|
+
IntervalResult ia_asech(IntervalResult x) {
|
|
54277
|
+
if (ia_is_error(x.status)) return x;
|
|
54278
|
+
return ia_asech(x.value);
|
|
54279
|
+
}
|
|
54280
|
+
|
|
54281
|
+
// Boolean interval comparisons
|
|
54282
|
+
// Returns 1.0 = true, 0.0 = false, 0.5 = maybe
|
|
54283
|
+
const float IA_TRUE = 1.0;
|
|
54284
|
+
const float IA_FALSE = 0.0;
|
|
54285
|
+
const float IA_MAYBE = 0.5;
|
|
54286
|
+
|
|
54287
|
+
float ia_less(vec2 a, vec2 b) {
|
|
54288
|
+
if (a.y < b.x) return IA_TRUE;
|
|
54289
|
+
if (a.x >= b.y) return IA_FALSE;
|
|
54290
|
+
return IA_MAYBE;
|
|
54291
|
+
}
|
|
54292
|
+
|
|
54293
|
+
float ia_lessEqual(vec2 a, vec2 b) {
|
|
54294
|
+
if (a.y <= b.x) return IA_TRUE;
|
|
54295
|
+
if (a.x > b.y) return IA_FALSE;
|
|
54296
|
+
return IA_MAYBE;
|
|
54297
|
+
}
|
|
54298
|
+
|
|
54299
|
+
float ia_greater(vec2 a, vec2 b) {
|
|
54300
|
+
if (a.x > b.y) return IA_TRUE;
|
|
54301
|
+
if (a.y <= b.x) return IA_FALSE;
|
|
54302
|
+
return IA_MAYBE;
|
|
54303
|
+
}
|
|
54304
|
+
|
|
54305
|
+
float ia_greaterEqual(vec2 a, vec2 b) {
|
|
54306
|
+
if (a.x >= b.y) return IA_TRUE;
|
|
54307
|
+
if (a.y < b.x) return IA_FALSE;
|
|
54308
|
+
return IA_MAYBE;
|
|
54309
|
+
}
|
|
54310
|
+
|
|
54311
|
+
float ia_equal(vec2 a, vec2 b) {
|
|
54312
|
+
if (a.x == a.y && b.x == b.y && a.x == b.x) return IA_TRUE;
|
|
54313
|
+
if (a.y < b.x || b.y < a.x) return IA_FALSE;
|
|
54314
|
+
return IA_MAYBE;
|
|
54315
|
+
}
|
|
54316
|
+
|
|
54317
|
+
float ia_notEqual(vec2 a, vec2 b) {
|
|
54318
|
+
float eq = ia_equal(a, b);
|
|
54319
|
+
if (eq == IA_TRUE) return IA_FALSE;
|
|
54320
|
+
if (eq == IA_FALSE) return IA_TRUE;
|
|
54321
|
+
return IA_MAYBE;
|
|
54322
|
+
}
|
|
54323
|
+
|
|
54324
|
+
float ia_and(float a, float b) {
|
|
54325
|
+
if (a == IA_FALSE || b == IA_FALSE) return IA_FALSE;
|
|
54326
|
+
if (a == IA_TRUE && b == IA_TRUE) return IA_TRUE;
|
|
54327
|
+
return IA_MAYBE;
|
|
54328
|
+
}
|
|
54329
|
+
|
|
54330
|
+
float ia_or(float a, float b) {
|
|
54331
|
+
if (a == IA_TRUE || b == IA_TRUE) return IA_TRUE;
|
|
54332
|
+
if (a == IA_FALSE && b == IA_FALSE) return IA_FALSE;
|
|
54333
|
+
return IA_MAYBE;
|
|
54334
|
+
}
|
|
54335
|
+
|
|
54336
|
+
float ia_not(float a) {
|
|
54337
|
+
if (a == IA_TRUE) return IA_FALSE;
|
|
54338
|
+
if (a == IA_FALSE) return IA_TRUE;
|
|
54339
|
+
return IA_MAYBE;
|
|
54340
|
+
}
|
|
54341
|
+
|
|
54342
|
+
// IntervalResult overloads for comparisons
|
|
54343
|
+
float ia_less(IntervalResult a, IntervalResult b) {
|
|
54344
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54345
|
+
return ia_less(a.value, b.value);
|
|
54346
|
+
}
|
|
54347
|
+
|
|
54348
|
+
float ia_lessEqual(IntervalResult a, IntervalResult b) {
|
|
54349
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54350
|
+
return ia_lessEqual(a.value, b.value);
|
|
54351
|
+
}
|
|
54352
|
+
|
|
54353
|
+
float ia_greater(IntervalResult a, IntervalResult b) {
|
|
54354
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54355
|
+
return ia_greater(a.value, b.value);
|
|
54356
|
+
}
|
|
54357
|
+
|
|
54358
|
+
float ia_greaterEqual(IntervalResult a, IntervalResult b) {
|
|
54359
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54360
|
+
return ia_greaterEqual(a.value, b.value);
|
|
54361
|
+
}
|
|
54362
|
+
|
|
54363
|
+
float ia_equal(IntervalResult a, IntervalResult b) {
|
|
54364
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54365
|
+
return ia_equal(a.value, b.value);
|
|
54366
|
+
}
|
|
54367
|
+
|
|
54368
|
+
float ia_notEqual(IntervalResult a, IntervalResult b) {
|
|
54369
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54370
|
+
return ia_notEqual(a.value, b.value);
|
|
54371
|
+
}
|
|
53820
54372
|
`;
|
|
53821
54373
|
var INTERVAL_GLSL_OPERATORS = {
|
|
53822
54374
|
Add: ["ia_add", 20],
|
|
@@ -53868,7 +54420,9 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53868
54420
|
Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
|
|
53869
54421
|
Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
|
|
53870
54422
|
Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
|
|
54423
|
+
Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
|
|
53871
54424
|
Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
|
|
54425
|
+
Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
|
|
53872
54426
|
Max: (args, compile) => {
|
|
53873
54427
|
if (args.length === 0) return "ia_point(-1e38)";
|
|
53874
54428
|
if (args.length === 1) return compile(args[0]);
|
|
@@ -53901,6 +54455,7 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53901
54455
|
}
|
|
53902
54456
|
throw new Error("Interval GLSL does not support variable exponents");
|
|
53903
54457
|
},
|
|
54458
|
+
Round: (args, compile) => `ia_round(${compile(args[0])})`,
|
|
53904
54459
|
Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
|
|
53905
54460
|
Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
|
|
53906
54461
|
Square: (args, compile) => `ia_square(${compile(args[0])})`,
|
|
@@ -53911,10 +54466,40 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53911
54466
|
Arcsin: (args, compile) => `ia_asin(${compile(args[0])})`,
|
|
53912
54467
|
Arccos: (args, compile) => `ia_acos(${compile(args[0])})`,
|
|
53913
54468
|
Arctan: (args, compile) => `ia_atan(${compile(args[0])})`,
|
|
54469
|
+
// Reciprocal trigonometric functions
|
|
54470
|
+
Cot: (args, compile) => `ia_cot(${compile(args[0])})`,
|
|
54471
|
+
Csc: (args, compile) => `ia_csc(${compile(args[0])})`,
|
|
54472
|
+
Sec: (args, compile) => `ia_sec(${compile(args[0])})`,
|
|
54473
|
+
// Inverse trigonometric (reciprocal)
|
|
54474
|
+
Arccot: (args, compile) => `ia_acot(${compile(args[0])})`,
|
|
54475
|
+
Arccsc: (args, compile) => `ia_acsc(${compile(args[0])})`,
|
|
54476
|
+
Arcsec: (args, compile) => `ia_asec(${compile(args[0])})`,
|
|
53914
54477
|
// Hyperbolic functions
|
|
53915
54478
|
Sinh: (args, compile) => `ia_sinh(${compile(args[0])})`,
|
|
53916
54479
|
Cosh: (args, compile) => `ia_cosh(${compile(args[0])})`,
|
|
53917
|
-
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})
|
|
54480
|
+
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`,
|
|
54481
|
+
// Reciprocal hyperbolic functions
|
|
54482
|
+
Coth: (args, compile) => `ia_coth(${compile(args[0])})`,
|
|
54483
|
+
Csch: (args, compile) => `ia_csch(${compile(args[0])})`,
|
|
54484
|
+
Sech: (args, compile) => `ia_sech(${compile(args[0])})`,
|
|
54485
|
+
// Inverse hyperbolic functions
|
|
54486
|
+
Arsinh: (args, compile) => `ia_asinh(${compile(args[0])})`,
|
|
54487
|
+
Arcosh: (args, compile) => `ia_acosh(${compile(args[0])})`,
|
|
54488
|
+
Artanh: (args, compile) => `ia_atanh(${compile(args[0])})`,
|
|
54489
|
+
// Inverse hyperbolic (reciprocal)
|
|
54490
|
+
Arcoth: (args, compile) => `ia_acoth(${compile(args[0])})`,
|
|
54491
|
+
Arcsch: (args, compile) => `ia_acsch(${compile(args[0])})`,
|
|
54492
|
+
Arsech: (args, compile) => `ia_asech(${compile(args[0])})`,
|
|
54493
|
+
// Comparison and logic (return float: 1.0=true, 0.0=false, 0.5=maybe)
|
|
54494
|
+
Equal: (args, compile) => `ia_equal(${compile(args[0])}, ${compile(args[1])})`,
|
|
54495
|
+
NotEqual: (args, compile) => `ia_notEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54496
|
+
Less: (args, compile) => `ia_less(${compile(args[0])}, ${compile(args[1])})`,
|
|
54497
|
+
LessEqual: (args, compile) => `ia_lessEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54498
|
+
Greater: (args, compile) => `ia_greater(${compile(args[0])}, ${compile(args[1])})`,
|
|
54499
|
+
GreaterEqual: (args, compile) => `ia_greaterEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54500
|
+
And: (args, compile) => `ia_and(${compile(args[0])}, ${compile(args[1])})`,
|
|
54501
|
+
Or: (args, compile) => `ia_or(${compile(args[0])}, ${compile(args[1])})`,
|
|
54502
|
+
Not: (args, compile) => `ia_not(${compile(args[0])})`
|
|
53918
54503
|
};
|
|
53919
54504
|
var IntervalGLSLTarget = class {
|
|
53920
54505
|
getOperators() {
|
|
@@ -55812,10 +56397,10 @@ function defToString(name, def, v) {
|
|
|
55812
56397
|
// src/compute-engine.ts
|
|
55813
56398
|
init_types6();
|
|
55814
56399
|
init_base_compiler();
|
|
55815
|
-
var version = "0.35.
|
|
56400
|
+
var version = "0.35.3";
|
|
55816
56401
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
55817
56402
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
55818
|
-
version: "0.35.
|
|
56403
|
+
version: "0.35.3"
|
|
55819
56404
|
};
|
|
55820
56405
|
export {
|
|
55821
56406
|
BaseCompiler,
|