@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
|
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, continuity: "right" };
|
|
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, continuity: "left" };
|
|
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, continuity: "right" };
|
|
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, continuity: "right" };
|
|
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, continuity: "right" };
|
|
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
|
|
@@ -53269,6 +53468,8 @@ const float IA_SINGULAR = 3.0;
|
|
|
53269
53468
|
const float IA_PARTIAL_LO = 4.0;
|
|
53270
53469
|
const float IA_PARTIAL_HI = 5.0;
|
|
53271
53470
|
const float IA_PARTIAL_BOTH = 6.0;
|
|
53471
|
+
const float IA_SINGULAR_RIGHT = 7.0;
|
|
53472
|
+
const float IA_SINGULAR_LEFT = 8.0;
|
|
53272
53473
|
|
|
53273
53474
|
// Interval result struct
|
|
53274
53475
|
struct IntervalResult {
|
|
@@ -53302,12 +53503,20 @@ IntervalResult ia_singular(float at) {
|
|
|
53302
53503
|
return IntervalResult(vec2(at, at), IA_SINGULAR);
|
|
53303
53504
|
}
|
|
53304
53505
|
|
|
53506
|
+
IntervalResult ia_singular_right(float at) {
|
|
53507
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_RIGHT);
|
|
53508
|
+
}
|
|
53509
|
+
|
|
53510
|
+
IntervalResult ia_singular_left(float at) {
|
|
53511
|
+
return IntervalResult(vec2(at, at), IA_SINGULAR_LEFT);
|
|
53512
|
+
}
|
|
53513
|
+
|
|
53305
53514
|
IntervalResult ia_partial(vec2 v, float clip) {
|
|
53306
53515
|
return IntervalResult(v, clip);
|
|
53307
53516
|
}
|
|
53308
53517
|
|
|
53309
53518
|
bool ia_is_error(float status) {
|
|
53310
|
-
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR;
|
|
53519
|
+
return status == IA_EMPTY || status == IA_ENTIRE || status == IA_SINGULAR || status == IA_SINGULAR_RIGHT || status == IA_SINGULAR_LEFT;
|
|
53311
53520
|
}
|
|
53312
53521
|
|
|
53313
53522
|
// Addition
|
|
@@ -53430,24 +53639,99 @@ IntervalResult ia_abs(vec2 x) {
|
|
|
53430
53639
|
return ia_ok(vec2(0.0, max(-x.x, x.y)));
|
|
53431
53640
|
}
|
|
53432
53641
|
|
|
53433
|
-
// Sign function
|
|
53642
|
+
// Sign function - has jump discontinuity at 0
|
|
53434
53643
|
IntervalResult ia_sign(vec2 x) {
|
|
53435
53644
|
if (x.x > 0.0) return ia_ok(vec2(1.0, 1.0));
|
|
53436
53645
|
if (x.y < 0.0) return ia_ok(vec2(-1.0, -1.0));
|
|
53437
53646
|
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));
|
|
53647
|
+
// Interval spans 0 - discontinuity
|
|
53648
|
+
return ia_singular(0.0);
|
|
53441
53649
|
}
|
|
53442
53650
|
|
|
53443
|
-
// Floor
|
|
53651
|
+
// Floor - has jump discontinuities at every integer
|
|
53444
53652
|
IntervalResult ia_floor(vec2 x) {
|
|
53445
|
-
|
|
53653
|
+
float flo = floor(x.x);
|
|
53654
|
+
float fhi = floor(x.y);
|
|
53655
|
+
if (flo == fhi) {
|
|
53656
|
+
return ia_ok(vec2(flo, fhi));
|
|
53657
|
+
}
|
|
53658
|
+
// Interval spans an integer boundary - discontinuity at first integer > x.x
|
|
53659
|
+
// floor is right-continuous
|
|
53660
|
+
return ia_singular_right(flo + 1.0);
|
|
53446
53661
|
}
|
|
53447
53662
|
|
|
53448
|
-
// Ceiling
|
|
53663
|
+
// Ceiling - has jump discontinuities at every integer
|
|
53449
53664
|
IntervalResult ia_ceil(vec2 x) {
|
|
53450
|
-
|
|
53665
|
+
float clo = ceil(x.x);
|
|
53666
|
+
float chi = ceil(x.y);
|
|
53667
|
+
if (clo == chi) {
|
|
53668
|
+
return ia_ok(vec2(clo, chi));
|
|
53669
|
+
}
|
|
53670
|
+
// Interval spans an integer boundary - discontinuity at ceil(x.x)
|
|
53671
|
+
// ceil is left-continuous
|
|
53672
|
+
return ia_singular_left(clo);
|
|
53673
|
+
}
|
|
53674
|
+
|
|
53675
|
+
// Round - has jump discontinuities at every half-integer
|
|
53676
|
+
// Note: GLSL round() uses IEEE 754 round-half-to-even, while JS Math.round
|
|
53677
|
+
// uses round-half-up. They differ only AT half-integers; discontinuity
|
|
53678
|
+
// detection is safe because intervals spanning half-integers return singular.
|
|
53679
|
+
IntervalResult ia_round(vec2 x) {
|
|
53680
|
+
float rlo = round(x.x);
|
|
53681
|
+
float rhi = round(x.y);
|
|
53682
|
+
if (rlo == rhi) {
|
|
53683
|
+
return ia_ok(vec2(rlo, rhi));
|
|
53684
|
+
}
|
|
53685
|
+
// Interval spans a half-integer boundary - discontinuity
|
|
53686
|
+
// round is right-continuous (with round-half-up convention)
|
|
53687
|
+
return ia_singular_right(rlo + 0.5);
|
|
53688
|
+
}
|
|
53689
|
+
|
|
53690
|
+
// Fract - sawtooth discontinuities at every integer
|
|
53691
|
+
// fract(x) = x - floor(x), jumps from ~1 back to 0 at each integer
|
|
53692
|
+
IntervalResult ia_fract(vec2 x) {
|
|
53693
|
+
float flo = floor(x.x);
|
|
53694
|
+
float fhi = floor(x.y);
|
|
53695
|
+
if (flo == fhi) {
|
|
53696
|
+
// No integer crossing - fract is continuous (linear) on this interval
|
|
53697
|
+
return ia_ok(vec2(fract(x.x) - IA_EPS, fract(x.y) + IA_EPS));
|
|
53698
|
+
}
|
|
53699
|
+
// Interval spans an integer - sawtooth discontinuity
|
|
53700
|
+
// fract is right-continuous (inherits from floor)
|
|
53701
|
+
return ia_singular_right(flo + 1.0);
|
|
53702
|
+
}
|
|
53703
|
+
|
|
53704
|
+
// Mod - periodic discontinuities at multiples of the modulus
|
|
53705
|
+
// mod(x, y) = x - y * floor(x / y)
|
|
53706
|
+
IntervalResult ia_mod(vec2 x, vec2 y) {
|
|
53707
|
+
// y contains zero - undefined
|
|
53708
|
+
if (y.x <= 0.0 && y.y >= 0.0) {
|
|
53709
|
+
return ia_singular(0.0);
|
|
53710
|
+
}
|
|
53711
|
+
|
|
53712
|
+
// Constant modulus (point interval) - common case
|
|
53713
|
+
if (y.x == y.y) {
|
|
53714
|
+
float period = abs(y.x);
|
|
53715
|
+
float flo = floor(x.x / period);
|
|
53716
|
+
float fhi = floor(x.y / period);
|
|
53717
|
+
if (flo == fhi) {
|
|
53718
|
+
// No discontinuity - mod is continuous (linear) on this interval
|
|
53719
|
+
float mlo = x.x - period * flo;
|
|
53720
|
+
float mhi = x.y - period * flo;
|
|
53721
|
+
return ia_ok(vec2(min(mlo, mhi) - IA_EPS, max(mlo, mhi) + IA_EPS));
|
|
53722
|
+
}
|
|
53723
|
+
// Discontinuity at first multiple of period in the interval
|
|
53724
|
+
// mod has sawtooth discontinuities, right-continuous
|
|
53725
|
+
return ia_singular_right((flo + 1.0) * period);
|
|
53726
|
+
}
|
|
53727
|
+
|
|
53728
|
+
// General case: compose from existing operations
|
|
53729
|
+
// Discontinuity detection comes from ia_floor
|
|
53730
|
+
IntervalResult q = ia_div(x, y);
|
|
53731
|
+
if (ia_is_error(q.status)) return q;
|
|
53732
|
+
IntervalResult fq = ia_floor(q.value);
|
|
53733
|
+
if (ia_is_error(fq.status)) return fq;
|
|
53734
|
+
return ia_sub(x, ia_mul_raw(y, fq.value));
|
|
53451
53735
|
}
|
|
53452
53736
|
|
|
53453
53737
|
// Min of two intervals
|
|
@@ -53736,6 +54020,32 @@ IntervalResult ia_ceil(IntervalResult x) {
|
|
|
53736
54020
|
return ia_ceil(x.value);
|
|
53737
54021
|
}
|
|
53738
54022
|
|
|
54023
|
+
IntervalResult ia_round(IntervalResult x) {
|
|
54024
|
+
if (ia_is_error(x.status)) return x;
|
|
54025
|
+
return ia_round(x.value);
|
|
54026
|
+
}
|
|
54027
|
+
|
|
54028
|
+
IntervalResult ia_fract(IntervalResult x) {
|
|
54029
|
+
if (ia_is_error(x.status)) return x;
|
|
54030
|
+
return ia_fract(x.value);
|
|
54031
|
+
}
|
|
54032
|
+
|
|
54033
|
+
IntervalResult ia_mod(IntervalResult a, IntervalResult b) {
|
|
54034
|
+
if (ia_is_error(a.status)) return a;
|
|
54035
|
+
if (ia_is_error(b.status)) return b;
|
|
54036
|
+
return ia_mod(a.value, b.value);
|
|
54037
|
+
}
|
|
54038
|
+
|
|
54039
|
+
IntervalResult ia_mod(IntervalResult a, vec2 b) {
|
|
54040
|
+
if (ia_is_error(a.status)) return a;
|
|
54041
|
+
return ia_mod(a.value, b);
|
|
54042
|
+
}
|
|
54043
|
+
|
|
54044
|
+
IntervalResult ia_mod(vec2 a, IntervalResult b) {
|
|
54045
|
+
if (ia_is_error(b.status)) return b;
|
|
54046
|
+
return ia_mod(a, b.value);
|
|
54047
|
+
}
|
|
54048
|
+
|
|
53739
54049
|
IntervalResult ia_min(IntervalResult a, IntervalResult b) {
|
|
53740
54050
|
if (ia_is_error(a.status)) return a;
|
|
53741
54051
|
if (ia_is_error(b.status)) return b;
|
|
@@ -53817,6 +54127,263 @@ IntervalResult ia_tanh(IntervalResult x) {
|
|
|
53817
54127
|
if (ia_is_error(x.status)) return x;
|
|
53818
54128
|
return ia_tanh(x.value);
|
|
53819
54129
|
}
|
|
54130
|
+
|
|
54131
|
+
// Cotangent (derived from cos/sin)
|
|
54132
|
+
IntervalResult ia_cot(vec2 x) {
|
|
54133
|
+
return ia_div(ia_cos(x), ia_sin(x));
|
|
54134
|
+
}
|
|
54135
|
+
|
|
54136
|
+
IntervalResult ia_cot(IntervalResult x) {
|
|
54137
|
+
if (ia_is_error(x.status)) return x;
|
|
54138
|
+
return ia_cot(x.value);
|
|
54139
|
+
}
|
|
54140
|
+
|
|
54141
|
+
// Cosecant (derived from 1/sin)
|
|
54142
|
+
IntervalResult ia_csc(vec2 x) {
|
|
54143
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sin(x));
|
|
54144
|
+
}
|
|
54145
|
+
|
|
54146
|
+
IntervalResult ia_csc(IntervalResult x) {
|
|
54147
|
+
if (ia_is_error(x.status)) return x;
|
|
54148
|
+
return ia_csc(x.value);
|
|
54149
|
+
}
|
|
54150
|
+
|
|
54151
|
+
// Secant (derived from 1/cos)
|
|
54152
|
+
IntervalResult ia_sec(vec2 x) {
|
|
54153
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cos(x));
|
|
54154
|
+
}
|
|
54155
|
+
|
|
54156
|
+
IntervalResult ia_sec(IntervalResult x) {
|
|
54157
|
+
if (ia_is_error(x.status)) return x;
|
|
54158
|
+
return ia_sec(x.value);
|
|
54159
|
+
}
|
|
54160
|
+
|
|
54161
|
+
// Inverse cotangent
|
|
54162
|
+
IntervalResult ia_acot(vec2 x) {
|
|
54163
|
+
return ia_atan(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54164
|
+
}
|
|
54165
|
+
|
|
54166
|
+
IntervalResult ia_acot(IntervalResult x) {
|
|
54167
|
+
if (ia_is_error(x.status)) return x;
|
|
54168
|
+
return ia_acot(x.value);
|
|
54169
|
+
}
|
|
54170
|
+
|
|
54171
|
+
// Inverse cosecant
|
|
54172
|
+
IntervalResult ia_acsc(vec2 x) {
|
|
54173
|
+
return ia_asin(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54174
|
+
}
|
|
54175
|
+
|
|
54176
|
+
IntervalResult ia_acsc(IntervalResult x) {
|
|
54177
|
+
if (ia_is_error(x.status)) return x;
|
|
54178
|
+
return ia_acsc(x.value);
|
|
54179
|
+
}
|
|
54180
|
+
|
|
54181
|
+
// Inverse secant
|
|
54182
|
+
IntervalResult ia_asec(vec2 x) {
|
|
54183
|
+
return ia_acos(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54184
|
+
}
|
|
54185
|
+
|
|
54186
|
+
IntervalResult ia_asec(IntervalResult x) {
|
|
54187
|
+
if (ia_is_error(x.status)) return x;
|
|
54188
|
+
return ia_asec(x.value);
|
|
54189
|
+
}
|
|
54190
|
+
|
|
54191
|
+
// Hyperbolic cotangent
|
|
54192
|
+
IntervalResult ia_coth(vec2 x) {
|
|
54193
|
+
return ia_div(ia_cosh(x), ia_sinh(x));
|
|
54194
|
+
}
|
|
54195
|
+
|
|
54196
|
+
IntervalResult ia_coth(IntervalResult x) {
|
|
54197
|
+
if (ia_is_error(x.status)) return x;
|
|
54198
|
+
return ia_coth(x.value);
|
|
54199
|
+
}
|
|
54200
|
+
|
|
54201
|
+
// Hyperbolic cosecant
|
|
54202
|
+
IntervalResult ia_csch(vec2 x) {
|
|
54203
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_sinh(x));
|
|
54204
|
+
}
|
|
54205
|
+
|
|
54206
|
+
IntervalResult ia_csch(IntervalResult x) {
|
|
54207
|
+
if (ia_is_error(x.status)) return x;
|
|
54208
|
+
return ia_csch(x.value);
|
|
54209
|
+
}
|
|
54210
|
+
|
|
54211
|
+
// Hyperbolic secant
|
|
54212
|
+
IntervalResult ia_sech(vec2 x) {
|
|
54213
|
+
return ia_div(ia_ok(vec2(1.0, 1.0)), ia_cosh(x));
|
|
54214
|
+
}
|
|
54215
|
+
|
|
54216
|
+
IntervalResult ia_sech(IntervalResult x) {
|
|
54217
|
+
if (ia_is_error(x.status)) return x;
|
|
54218
|
+
return ia_sech(x.value);
|
|
54219
|
+
}
|
|
54220
|
+
|
|
54221
|
+
// Inverse hyperbolic sine
|
|
54222
|
+
IntervalResult ia_asinh(vec2 x) {
|
|
54223
|
+
return ia_ok(vec2(asinh(x.x) - IA_EPS, asinh(x.y) + IA_EPS));
|
|
54224
|
+
}
|
|
54225
|
+
|
|
54226
|
+
IntervalResult ia_asinh(IntervalResult x) {
|
|
54227
|
+
if (ia_is_error(x.status)) return x;
|
|
54228
|
+
return ia_asinh(x.value);
|
|
54229
|
+
}
|
|
54230
|
+
|
|
54231
|
+
// Inverse hyperbolic cosine
|
|
54232
|
+
IntervalResult ia_acosh(vec2 x) {
|
|
54233
|
+
if (x.y < 1.0) {
|
|
54234
|
+
return ia_empty();
|
|
54235
|
+
}
|
|
54236
|
+
if (x.x >= 1.0) {
|
|
54237
|
+
return ia_ok(vec2(acosh(x.x) - IA_EPS, acosh(x.y) + IA_EPS));
|
|
54238
|
+
}
|
|
54239
|
+
return ia_partial(vec2(0.0, acosh(x.y) + IA_EPS), IA_PARTIAL_LO);
|
|
54240
|
+
}
|
|
54241
|
+
|
|
54242
|
+
IntervalResult ia_acosh(IntervalResult x) {
|
|
54243
|
+
if (ia_is_error(x.status)) return x;
|
|
54244
|
+
return ia_acosh(x.value);
|
|
54245
|
+
}
|
|
54246
|
+
|
|
54247
|
+
// Inverse hyperbolic tangent
|
|
54248
|
+
IntervalResult ia_atanh(vec2 x) {
|
|
54249
|
+
if (x.x >= 1.0 || x.y <= -1.0) {
|
|
54250
|
+
return ia_empty();
|
|
54251
|
+
}
|
|
54252
|
+
vec2 clipped = vec2(max(x.x, -1.0 + IA_EPS), min(x.y, 1.0 - IA_EPS));
|
|
54253
|
+
if (x.x < -1.0 || x.y > 1.0) {
|
|
54254
|
+
float clip = (x.x < -1.0 && x.y > 1.0) ? IA_PARTIAL_BOTH :
|
|
54255
|
+
(x.x < -1.0) ? IA_PARTIAL_LO : IA_PARTIAL_HI;
|
|
54256
|
+
return ia_partial(vec2(atanh(clipped.x) - IA_EPS, atanh(clipped.y) + IA_EPS), clip);
|
|
54257
|
+
}
|
|
54258
|
+
return ia_ok(vec2(atanh(x.x) - IA_EPS, atanh(x.y) + IA_EPS));
|
|
54259
|
+
}
|
|
54260
|
+
|
|
54261
|
+
IntervalResult ia_atanh(IntervalResult x) {
|
|
54262
|
+
if (ia_is_error(x.status)) return x;
|
|
54263
|
+
return ia_atanh(x.value);
|
|
54264
|
+
}
|
|
54265
|
+
|
|
54266
|
+
// Inverse hyperbolic cotangent
|
|
54267
|
+
IntervalResult ia_acoth(vec2 x) {
|
|
54268
|
+
return ia_atanh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54269
|
+
}
|
|
54270
|
+
|
|
54271
|
+
IntervalResult ia_acoth(IntervalResult x) {
|
|
54272
|
+
if (ia_is_error(x.status)) return x;
|
|
54273
|
+
return ia_acoth(x.value);
|
|
54274
|
+
}
|
|
54275
|
+
|
|
54276
|
+
// Inverse hyperbolic cosecant
|
|
54277
|
+
IntervalResult ia_acsch(vec2 x) {
|
|
54278
|
+
return ia_asinh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54279
|
+
}
|
|
54280
|
+
|
|
54281
|
+
IntervalResult ia_acsch(IntervalResult x) {
|
|
54282
|
+
if (ia_is_error(x.status)) return x;
|
|
54283
|
+
return ia_acsch(x.value);
|
|
54284
|
+
}
|
|
54285
|
+
|
|
54286
|
+
// Inverse hyperbolic secant
|
|
54287
|
+
IntervalResult ia_asech(vec2 x) {
|
|
54288
|
+
return ia_acosh(ia_div(ia_ok(vec2(1.0, 1.0)), ia_ok(x)));
|
|
54289
|
+
}
|
|
54290
|
+
|
|
54291
|
+
IntervalResult ia_asech(IntervalResult x) {
|
|
54292
|
+
if (ia_is_error(x.status)) return x;
|
|
54293
|
+
return ia_asech(x.value);
|
|
54294
|
+
}
|
|
54295
|
+
|
|
54296
|
+
// Boolean interval comparisons
|
|
54297
|
+
// Returns 1.0 = true, 0.0 = false, 0.5 = maybe
|
|
54298
|
+
const float IA_TRUE = 1.0;
|
|
54299
|
+
const float IA_FALSE = 0.0;
|
|
54300
|
+
const float IA_MAYBE = 0.5;
|
|
54301
|
+
|
|
54302
|
+
float ia_less(vec2 a, vec2 b) {
|
|
54303
|
+
if (a.y < b.x) return IA_TRUE;
|
|
54304
|
+
if (a.x >= b.y) return IA_FALSE;
|
|
54305
|
+
return IA_MAYBE;
|
|
54306
|
+
}
|
|
54307
|
+
|
|
54308
|
+
float ia_lessEqual(vec2 a, vec2 b) {
|
|
54309
|
+
if (a.y <= b.x) return IA_TRUE;
|
|
54310
|
+
if (a.x > b.y) return IA_FALSE;
|
|
54311
|
+
return IA_MAYBE;
|
|
54312
|
+
}
|
|
54313
|
+
|
|
54314
|
+
float ia_greater(vec2 a, vec2 b) {
|
|
54315
|
+
if (a.x > b.y) return IA_TRUE;
|
|
54316
|
+
if (a.y <= b.x) return IA_FALSE;
|
|
54317
|
+
return IA_MAYBE;
|
|
54318
|
+
}
|
|
54319
|
+
|
|
54320
|
+
float ia_greaterEqual(vec2 a, vec2 b) {
|
|
54321
|
+
if (a.x >= b.y) return IA_TRUE;
|
|
54322
|
+
if (a.y < b.x) return IA_FALSE;
|
|
54323
|
+
return IA_MAYBE;
|
|
54324
|
+
}
|
|
54325
|
+
|
|
54326
|
+
float ia_equal(vec2 a, vec2 b) {
|
|
54327
|
+
if (a.x == a.y && b.x == b.y && a.x == b.x) return IA_TRUE;
|
|
54328
|
+
if (a.y < b.x || b.y < a.x) return IA_FALSE;
|
|
54329
|
+
return IA_MAYBE;
|
|
54330
|
+
}
|
|
54331
|
+
|
|
54332
|
+
float ia_notEqual(vec2 a, vec2 b) {
|
|
54333
|
+
float eq = ia_equal(a, b);
|
|
54334
|
+
if (eq == IA_TRUE) return IA_FALSE;
|
|
54335
|
+
if (eq == IA_FALSE) return IA_TRUE;
|
|
54336
|
+
return IA_MAYBE;
|
|
54337
|
+
}
|
|
54338
|
+
|
|
54339
|
+
float ia_and(float a, float b) {
|
|
54340
|
+
if (a == IA_FALSE || b == IA_FALSE) return IA_FALSE;
|
|
54341
|
+
if (a == IA_TRUE && b == IA_TRUE) return IA_TRUE;
|
|
54342
|
+
return IA_MAYBE;
|
|
54343
|
+
}
|
|
54344
|
+
|
|
54345
|
+
float ia_or(float a, float b) {
|
|
54346
|
+
if (a == IA_TRUE || b == IA_TRUE) return IA_TRUE;
|
|
54347
|
+
if (a == IA_FALSE && b == IA_FALSE) return IA_FALSE;
|
|
54348
|
+
return IA_MAYBE;
|
|
54349
|
+
}
|
|
54350
|
+
|
|
54351
|
+
float ia_not(float a) {
|
|
54352
|
+
if (a == IA_TRUE) return IA_FALSE;
|
|
54353
|
+
if (a == IA_FALSE) return IA_TRUE;
|
|
54354
|
+
return IA_MAYBE;
|
|
54355
|
+
}
|
|
54356
|
+
|
|
54357
|
+
// IntervalResult overloads for comparisons
|
|
54358
|
+
float ia_less(IntervalResult a, IntervalResult b) {
|
|
54359
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54360
|
+
return ia_less(a.value, b.value);
|
|
54361
|
+
}
|
|
54362
|
+
|
|
54363
|
+
float ia_lessEqual(IntervalResult a, IntervalResult b) {
|
|
54364
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54365
|
+
return ia_lessEqual(a.value, b.value);
|
|
54366
|
+
}
|
|
54367
|
+
|
|
54368
|
+
float ia_greater(IntervalResult a, IntervalResult b) {
|
|
54369
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54370
|
+
return ia_greater(a.value, b.value);
|
|
54371
|
+
}
|
|
54372
|
+
|
|
54373
|
+
float ia_greaterEqual(IntervalResult a, IntervalResult b) {
|
|
54374
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54375
|
+
return ia_greaterEqual(a.value, b.value);
|
|
54376
|
+
}
|
|
54377
|
+
|
|
54378
|
+
float ia_equal(IntervalResult a, IntervalResult b) {
|
|
54379
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54380
|
+
return ia_equal(a.value, b.value);
|
|
54381
|
+
}
|
|
54382
|
+
|
|
54383
|
+
float ia_notEqual(IntervalResult a, IntervalResult b) {
|
|
54384
|
+
if (ia_is_error(a.status) || ia_is_error(b.status)) return IA_MAYBE;
|
|
54385
|
+
return ia_notEqual(a.value, b.value);
|
|
54386
|
+
}
|
|
53820
54387
|
`;
|
|
53821
54388
|
var INTERVAL_GLSL_OPERATORS = {
|
|
53822
54389
|
Add: ["ia_add", 20],
|
|
@@ -53868,7 +54435,9 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53868
54435
|
Ceiling: (args, compile) => `ia_ceil(${compile(args[0])})`,
|
|
53869
54436
|
Exp: (args, compile) => `ia_exp(${compile(args[0])})`,
|
|
53870
54437
|
Floor: (args, compile) => `ia_floor(${compile(args[0])})`,
|
|
54438
|
+
Fract: (args, compile) => `ia_fract(${compile(args[0])})`,
|
|
53871
54439
|
Ln: (args, compile) => `ia_ln(${compile(args[0])})`,
|
|
54440
|
+
Mod: (args, compile) => `ia_mod(${compile(args[0])}, ${compile(args[1])})`,
|
|
53872
54441
|
Max: (args, compile) => {
|
|
53873
54442
|
if (args.length === 0) return "ia_point(-1e38)";
|
|
53874
54443
|
if (args.length === 1) return compile(args[0]);
|
|
@@ -53901,6 +54470,7 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53901
54470
|
}
|
|
53902
54471
|
throw new Error("Interval GLSL does not support variable exponents");
|
|
53903
54472
|
},
|
|
54473
|
+
Round: (args, compile) => `ia_round(${compile(args[0])})`,
|
|
53904
54474
|
Sgn: (args, compile) => `ia_sign(${compile(args[0])})`,
|
|
53905
54475
|
Sqrt: (args, compile) => `ia_sqrt(${compile(args[0])})`,
|
|
53906
54476
|
Square: (args, compile) => `ia_square(${compile(args[0])})`,
|
|
@@ -53911,10 +54481,40 @@ var INTERVAL_GLSL_FUNCTIONS = {
|
|
|
53911
54481
|
Arcsin: (args, compile) => `ia_asin(${compile(args[0])})`,
|
|
53912
54482
|
Arccos: (args, compile) => `ia_acos(${compile(args[0])})`,
|
|
53913
54483
|
Arctan: (args, compile) => `ia_atan(${compile(args[0])})`,
|
|
54484
|
+
// Reciprocal trigonometric functions
|
|
54485
|
+
Cot: (args, compile) => `ia_cot(${compile(args[0])})`,
|
|
54486
|
+
Csc: (args, compile) => `ia_csc(${compile(args[0])})`,
|
|
54487
|
+
Sec: (args, compile) => `ia_sec(${compile(args[0])})`,
|
|
54488
|
+
// Inverse trigonometric (reciprocal)
|
|
54489
|
+
Arccot: (args, compile) => `ia_acot(${compile(args[0])})`,
|
|
54490
|
+
Arccsc: (args, compile) => `ia_acsc(${compile(args[0])})`,
|
|
54491
|
+
Arcsec: (args, compile) => `ia_asec(${compile(args[0])})`,
|
|
53914
54492
|
// Hyperbolic functions
|
|
53915
54493
|
Sinh: (args, compile) => `ia_sinh(${compile(args[0])})`,
|
|
53916
54494
|
Cosh: (args, compile) => `ia_cosh(${compile(args[0])})`,
|
|
53917
|
-
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})
|
|
54495
|
+
Tanh: (args, compile) => `ia_tanh(${compile(args[0])})`,
|
|
54496
|
+
// Reciprocal hyperbolic functions
|
|
54497
|
+
Coth: (args, compile) => `ia_coth(${compile(args[0])})`,
|
|
54498
|
+
Csch: (args, compile) => `ia_csch(${compile(args[0])})`,
|
|
54499
|
+
Sech: (args, compile) => `ia_sech(${compile(args[0])})`,
|
|
54500
|
+
// Inverse hyperbolic functions
|
|
54501
|
+
Arsinh: (args, compile) => `ia_asinh(${compile(args[0])})`,
|
|
54502
|
+
Arcosh: (args, compile) => `ia_acosh(${compile(args[0])})`,
|
|
54503
|
+
Artanh: (args, compile) => `ia_atanh(${compile(args[0])})`,
|
|
54504
|
+
// Inverse hyperbolic (reciprocal)
|
|
54505
|
+
Arcoth: (args, compile) => `ia_acoth(${compile(args[0])})`,
|
|
54506
|
+
Arcsch: (args, compile) => `ia_acsch(${compile(args[0])})`,
|
|
54507
|
+
Arsech: (args, compile) => `ia_asech(${compile(args[0])})`,
|
|
54508
|
+
// Comparison and logic (return float: 1.0=true, 0.0=false, 0.5=maybe)
|
|
54509
|
+
Equal: (args, compile) => `ia_equal(${compile(args[0])}, ${compile(args[1])})`,
|
|
54510
|
+
NotEqual: (args, compile) => `ia_notEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54511
|
+
Less: (args, compile) => `ia_less(${compile(args[0])}, ${compile(args[1])})`,
|
|
54512
|
+
LessEqual: (args, compile) => `ia_lessEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54513
|
+
Greater: (args, compile) => `ia_greater(${compile(args[0])}, ${compile(args[1])})`,
|
|
54514
|
+
GreaterEqual: (args, compile) => `ia_greaterEqual(${compile(args[0])}, ${compile(args[1])})`,
|
|
54515
|
+
And: (args, compile) => `ia_and(${compile(args[0])}, ${compile(args[1])})`,
|
|
54516
|
+
Or: (args, compile) => `ia_or(${compile(args[0])}, ${compile(args[1])})`,
|
|
54517
|
+
Not: (args, compile) => `ia_not(${compile(args[0])})`
|
|
53918
54518
|
};
|
|
53919
54519
|
var IntervalGLSLTarget = class {
|
|
53920
54520
|
getOperators() {
|
|
@@ -55812,10 +56412,10 @@ function defToString(name, def, v) {
|
|
|
55812
56412
|
// src/compute-engine.ts
|
|
55813
56413
|
init_types6();
|
|
55814
56414
|
init_base_compiler();
|
|
55815
|
-
var version = "0.35.
|
|
56415
|
+
var version = "0.35.4";
|
|
55816
56416
|
globalThis[Symbol.for("io.cortexjs.compute-engine")] = {
|
|
55817
56417
|
ComputeEngine: ComputeEngine.prototype.constructor,
|
|
55818
|
-
version: "0.35.
|
|
56418
|
+
version: "0.35.4"
|
|
55819
56419
|
};
|
|
55820
56420
|
export {
|
|
55821
56421
|
BaseCompiler,
|