@sheetxl/formulas 0.7.28-beta.4 → 0.8.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +15 -22
  2. package/browser/esm/{DQXZXiayIDbfnOUM.mjs → -sN4SmS9cUOrcjVR.mjs} +1 -1
  3. package/browser/esm/{K0CU2XaCnJJwh9a5.mjs → 0Q46gxHg8afOLJ7K.mjs} +37 -3
  4. package/{node/esm/B2zbBC2YuaYszbHd.mjs → browser/esm/B-Ig6HWcV53g7Zy0.mjs} +1 -1
  5. package/browser/esm/{ec8i9mVgadWEbuYy.mjs → B3LvTqivuAJYZW9O.mjs} +1 -1
  6. package/browser/esm/{CB4iUafw8x-4z_ff.mjs → B52kG70ukWJKrVHl.mjs} +2 -5
  7. package/browser/esm/{BXyQ76W9hObzOdf2.mjs → B9GCCzx3ZtHrtgsZ.mjs} +1 -1
  8. package/{node/esm/CmxGNGhfoNTz4Ku7.mjs → browser/esm/BCRhRyTDe0QO3_TF.mjs} +2 -2
  9. package/browser/esm/{DNz39xRoqy8IPYb3.mjs → BTygNwyrCzzpikEl.mjs} +1 -1
  10. package/{node/esm/BIxWkCV-r5U5zPnQ.mjs → browser/esm/C1TlAj8cFI90ziZT.mjs} +51 -11
  11. package/browser/esm/{Ctxig2_c-GErg911.mjs → C2WtsJFzD2GtwSHc.mjs} +69 -4
  12. package/{node/esm/BM0KaGfI1Lqav17f.mjs → browser/esm/C2nw0NszguSU0idO.mjs} +1 -1
  13. package/browser/esm/{AuzqFslmIMxseCn8.mjs → CXDwT-uLbi_ZUF6Q.mjs} +1 -1
  14. package/browser/esm/{jFM2MqBdxFWP6QmN.mjs → CXvEGkvOOLo4v17T.mjs} +1 -1
  15. package/browser/esm/{B2b-ZmAhe94pNDT0.mjs → CYtUFqOZCtbGw6Sa.mjs} +1 -1
  16. package/browser/esm/{DIUPlZfIoj507k-C.mjs → CpGJ_hA0h7CW4Jwu.mjs} +1 -1
  17. package/{node/esm/CWI62PClHru85-mL.mjs → browser/esm/CrfZkfvKRkK2qzpP.mjs} +1 -1
  18. package/browser/esm/{BHG0YIMg5kOV3mNl.mjs → D-w_d2PrWN8kwM-Z.mjs} +1 -1
  19. package/browser/esm/{VRXC1SwOYSkv1Vs4.mjs → DG5YNbA9Ya6Uu3DG.mjs} +1 -1
  20. package/{node/esm/ymPI-MJUjuYe2n5v.mjs → browser/esm/DO9cbfqY2roOBQQi.mjs} +1 -1
  21. package/{node/esm/Co7O0P5yM1i0exNK.mjs → browser/esm/DYoyWWN86dEdpzVg.mjs} +1 -1
  22. package/browser/esm/{wDeMNrClyQscDTwZ.mjs → D_PYZQxUASNNORTU.mjs} +48 -2
  23. package/{node/esm/DjFalvyAcEOwNagC.mjs → browser/esm/KekfJtUQq6sPOmPq.mjs} +1 -1
  24. package/browser/esm/{DiV1y5wtlmlsRDfm.mjs → PDRj7r-fmSBrQgPS.mjs} +1 -1
  25. package/browser/esm/index.mjs +5186 -5889
  26. package/licenses/dependencies.txt +0 -33
  27. package/node/esm/{DQXZXiayIDbfnOUM.mjs → -sN4SmS9cUOrcjVR.mjs} +1 -1
  28. package/node/esm/{K0CU2XaCnJJwh9a5.mjs → 0Q46gxHg8afOLJ7K.mjs} +37 -3
  29. package/{browser/esm/B2zbBC2YuaYszbHd.mjs → node/esm/B-Ig6HWcV53g7Zy0.mjs} +1 -1
  30. package/node/esm/{CB4iUafw8x-4z_ff.mjs → B52kG70ukWJKrVHl.mjs} +2 -5
  31. package/node/esm/{BXyQ76W9hObzOdf2.mjs → B9GCCzx3ZtHrtgsZ.mjs} +1 -1
  32. package/{browser/esm/CmxGNGhfoNTz4Ku7.mjs → node/esm/BCRhRyTDe0QO3_TF.mjs} +2 -2
  33. package/node/esm/{Dnrd8jP_j1AWCUX6.mjs → BN0QCtL-dZU8U-hd.mjs} +1 -1
  34. package/node/esm/{8_dh9QnzvNBCvWpp.mjs → Bp4XujtHH5z4dKlz.mjs} +1 -1
  35. package/{browser/esm/BIxWkCV-r5U5zPnQ.mjs → node/esm/C--VBbIp253pJfw9.mjs} +51 -11
  36. package/node/esm/{BsBiI5HHw7jjXgp5.mjs → C-jlV3objhN9hpyt.mjs} +1 -1
  37. package/node/esm/{D1iK18Nn8mRQo6Fk.mjs → C1Qq-yVzO0uZUnVb.mjs} +1 -1
  38. package/node/esm/{Ctxig2_c-GErg911.mjs → C2WtsJFzD2GtwSHc.mjs} +69 -4
  39. package/{browser/esm/BM0KaGfI1Lqav17f.mjs → node/esm/C2nw0NszguSU0idO.mjs} +1 -1
  40. package/node/esm/{B2b-ZmAhe94pNDT0.mjs → CYtUFqOZCtbGw6Sa.mjs} +1 -1
  41. package/node/esm/{DcSbVdpEmRbpaZf0.mjs → Cf28UVIhJr5Y-_24.mjs} +1 -1
  42. package/node/esm/{wDeMNrClyQscDTwZ.mjs → CkO4Hx9aLq7m3emI.mjs} +48 -2
  43. package/{browser/esm/CWI62PClHru85-mL.mjs → node/esm/CrfZkfvKRkK2qzpP.mjs} +1 -1
  44. package/node/esm/{BHG0YIMg5kOV3mNl.mjs → D-w_d2PrWN8kwM-Z.mjs} +1 -1
  45. package/node/esm/{VRXC1SwOYSkv1Vs4.mjs → DG5YNbA9Ya6Uu3DG.mjs} +1 -1
  46. package/{browser/esm/ymPI-MJUjuYe2n5v.mjs → node/esm/DO9cbfqY2roOBQQi.mjs} +1 -1
  47. package/{browser/esm/Co7O0P5yM1i0exNK.mjs → node/esm/DYoyWWN86dEdpzVg.mjs} +1 -1
  48. package/{browser/esm/DjFalvyAcEOwNagC.mjs → node/esm/KekfJtUQq6sPOmPq.mjs} +1 -1
  49. package/node/esm/{DiV1y5wtlmlsRDfm.mjs → PDRj7r-fmSBrQgPS.mjs} +1 -1
  50. package/node/esm/index.mjs +5778 -4648
  51. package/package.json +6 -8
  52. package/types/src/.generated/decl/dateTime/Date.decl.d.ts +2 -1
  53. package/types/src/.generated/decl/information/Information.decl.d.ts +2 -1
  54. package/types/src/.generated/decl/lookupReference/Reference.decl.d.ts +2 -1
  55. package/types/src/.generated/decl/mathTrig/Math.decl.d.ts +2 -1
  56. package/types/src/.generated/desc/dateTime/Date.desc.d.ts +2 -1
  57. package/types/src/.generated/desc/information/Information.desc.d.ts +2 -1
  58. package/types/src/.generated/desc/lookupReference/Reference.desc.d.ts +2 -1
  59. package/types/src/.generated/desc/mathTrig/Math.desc.d.ts +2 -1
  60. package/types/src/_utils/AValues.d.ts +30 -0
  61. package/types/src/_utils/AggregateIFS.d.ts +5 -3
  62. package/types/src/_utils/Arithmetic.d.ts +36 -0
  63. package/types/src/_utils/Combinatorics.d.ts +20 -0
  64. package/types/src/_utils/Distributions.d.ts +94 -0
  65. package/types/src/_utils/Errors.d.ts +1 -20
  66. package/types/src/_utils/FirstCell.d.ts +32 -0
  67. package/types/src/_utils/Matrix.d.ts +31 -0
  68. package/types/src/_utils/SpecialFunctions.d.ts +91 -0
  69. package/types/src/_utils/X87.d.ts +28 -0
  70. package/types/src/database/Database.d.ts +25 -25
  71. package/types/src/dateTime/Date.d.ts +250 -41
  72. package/types/src/engineering/Bessel.d.ts +9 -9
  73. package/types/src/engineering/Bitwise.d.ts +35 -35
  74. package/types/src/engineering/Convert.d.ts +3 -3
  75. package/types/src/engineering/Engineering.d.ts +5 -5
  76. package/types/src/engineering/Error.d.ts +9 -9
  77. package/types/src/engineering/Imaginary.d.ts +54 -54
  78. package/types/src/information/Information.d.ts +124 -55
  79. package/types/src/japanese/Date.d.ts +2 -2
  80. package/types/src/japanese/Text.d.ts +1 -1
  81. package/types/src/logical/Logical.d.ts +45 -39
  82. package/types/src/lookupReference/Reference.d.ts +212 -86
  83. package/types/src/mathTrig/Math.d.ts +499 -149
  84. package/types/src/mathTrig/Trig.d.ts +26 -22
  85. package/types/src/operators/Operators.d.ts +15 -15
  86. package/types/src/statistical/Distribution.d.ts +157 -161
  87. package/types/src/statistical/Statistical.d.ts +37 -37
  88. package/types/src/testing/Testing.d.ts +2 -2
  89. package/types/src/text/Text.d.ts +119 -54
  90. package/types/src/thai/Text.d.ts +1 -1
  91. package/types/src/web/FilterXML.d.ts +1 -1
  92. package/types/src/web/Web.d.ts +2 -2
  93. package/browser/cjs/1XrWGMP3GmsQOMIX.cjs +0 -1
  94. package/browser/cjs/49_x589Na12sizKK.cjs +0 -1
  95. package/browser/cjs/4nReftSsKWmnRdtf.cjs +0 -1
  96. package/browser/cjs/507hQYooKKjnRzsZ.cjs +0 -1
  97. package/browser/cjs/BAxVLKkxFgI6cXnR.cjs +0 -1
  98. package/browser/cjs/BK0SCfN_VZYqBxoQ.cjs +0 -1
  99. package/browser/cjs/Btc0Nzu40VYOpzLX.cjs +0 -1
  100. package/browser/cjs/C9C-pr-T_ThweQX9.cjs +0 -1
  101. package/browser/cjs/CJYewYJ5Z3iojl7J.cjs +0 -1
  102. package/browser/cjs/CRx1WvmgBjT8WVyB.cjs +0 -1
  103. package/browser/cjs/CV4KQsHluMqo1I2Q.cjs +0 -1
  104. package/browser/cjs/CXlzsh_WHCOsErJ1.cjs +0 -1
  105. package/browser/cjs/CpJJh4UnFl1_qFui.cjs +0 -1
  106. package/browser/cjs/CrZlUtdX1h2RUnCP.cjs +0 -1
  107. package/browser/cjs/D8-KovdJ0LjxqCe2.cjs +0 -1
  108. package/browser/cjs/DCIlWcGDrp-5PDoA.cjs +0 -1
  109. package/browser/cjs/DDnGLOLTqLFsdUDS.cjs +0 -1
  110. package/browser/cjs/DG2kqsWRUtVugjay.cjs +0 -1
  111. package/browser/cjs/DM7-R_ltoLbA9jde.cjs +0 -1
  112. package/browser/cjs/DNKyaSruDogoBd2H.cjs +0 -1
  113. package/browser/cjs/Du4jBiFxRIF1OjD4.cjs +0 -1
  114. package/browser/cjs/EeOVMRq7TuptFKTc.cjs +0 -1
  115. package/browser/cjs/Kvn916ebqGc4t6hv.cjs +0 -1
  116. package/browser/cjs/aONv0Ys3C8xmnaR8.cjs +0 -1
  117. package/browser/cjs/index.cjs +0 -1
  118. package/browser/cjs/z_rZE1OHFPpdGBh4.cjs +0 -1
  119. package/browser/esm/74anAHR6YDREjbgI.mjs +0 -24
  120. package/browser/esm/BebVPCumXxQqABDP.mjs +0 -21
  121. package/node/esm/74anAHR6YDREjbgI.mjs +0 -24
  122. package/node/esm/BebVPCumXxQqABDP.mjs +0 -21
  123. package/types/src/.generated/decl/lookupReference/GroupBy.decl.d.ts +0 -4
  124. package/types/src/.generated/decl/lookupReference/PivotBy.decl.d.ts +0 -4
  125. package/types/src/.generated/desc/lookupReference/GroupBy.desc.d.ts +0 -4
  126. package/types/src/.generated/desc/lookupReference/PivotBy.desc.d.ts +0 -4
  127. package/types/src/lookupReference/GroupBy.d.ts +0 -19
  128. package/types/src/lookupReference/PivotBy.d.ts +0 -24
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/formulas",
3
3
  "description": "Formulas - TypeScript formulas compatible with Excel built-ins.",
4
- "version": "0.7.28-beta.4",
4
+ "version": "0.8.0-beta.10",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -9,13 +9,12 @@
9
9
  "types": "./types/index.d.ts",
10
10
  "browser": "./browser/esm/index.mjs",
11
11
  "node": "./node/esm/index.mjs",
12
- "import": "./browser/esm/index.mjs",
13
- "require": "./browser/cjs/index.cjs"
12
+ "default": "./browser/esm/index.mjs"
14
13
  }
15
14
  },
16
15
  "types": "./types/index.d.ts",
17
16
  "module": "./browser/esm/index.mjs",
18
- "main": "./browser/cjs/index.cjs",
17
+ "main": "./browser/esm/index.mjs",
19
18
  "sideEffects": false,
20
19
  "engineStrict": true,
21
20
  "homepage": "https://sheetxl.com",
@@ -37,10 +36,9 @@
37
36
  "formulas"
38
37
  ],
39
38
  "dependencies": {
40
- "@sheetxl/primitives": "^0.7.28-beta.4",
41
- "@sheetxl/scripting": "^0.7.28-beta.4",
39
+ "@sheetxl/primitives": "^0.8.0-beta.10",
40
+ "@sheetxl/scripting": "^0.8.0-beta.10",
42
41
  "bahttext": "^2.4.0",
43
- "bessel": "^1.0.2",
44
- "jstat": "^1.9.6"
42
+ "bessel": "^1.0.2"
45
43
  }
46
44
  }
@@ -1,4 +1,5 @@
1
- import { MinifiedDeclarations } from '@sheetxl/scripting';
1
+ import { MinifiedDeclarations, MinifiedEnums } from '@sheetxl/scripting';
2
2
  declare const declarations: MinifiedDeclarations;
3
+ export declare const enums: MinifiedEnums;
3
4
  export default declarations;
4
5
  //# sourceMappingURL=Date.decl.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDeclarations } from '@sheetxl/scripting';
1
+ import { MinifiedDeclarations, MinifiedEnums } from '@sheetxl/scripting';
2
2
  declare const declarations: MinifiedDeclarations;
3
+ export declare const enums: MinifiedEnums;
3
4
  export default declarations;
4
5
  //# sourceMappingURL=Information.decl.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDeclarations } from '@sheetxl/scripting';
1
+ import { MinifiedDeclarations, MinifiedEnums } from '@sheetxl/scripting';
2
2
  declare const declarations: MinifiedDeclarations;
3
+ export declare const enums: MinifiedEnums;
3
4
  export default declarations;
4
5
  //# sourceMappingURL=Reference.decl.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDeclarations } from '@sheetxl/scripting';
1
+ import { MinifiedDeclarations, MinifiedEnums } from '@sheetxl/scripting';
2
2
  declare const declarations: MinifiedDeclarations;
3
+ export declare const enums: MinifiedEnums;
3
4
  export default declarations;
4
5
  //# sourceMappingURL=Math.decl.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDescriptors } from '@sheetxl/scripting';
1
+ import { MinifiedDescriptors, MinifiedEnumDescriptors } from '@sheetxl/scripting';
2
2
  declare const descriptors: MinifiedDescriptors;
3
+ export declare const enums: MinifiedEnumDescriptors;
3
4
  export default descriptors;
4
5
  //# sourceMappingURL=Date.desc.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDescriptors } from '@sheetxl/scripting';
1
+ import { MinifiedDescriptors, MinifiedEnumDescriptors } from '@sheetxl/scripting';
2
2
  declare const descriptors: MinifiedDescriptors;
3
+ export declare const enums: MinifiedEnumDescriptors;
3
4
  export default descriptors;
4
5
  //# sourceMappingURL=Information.desc.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDescriptors } from '@sheetxl/scripting';
1
+ import { MinifiedDescriptors, MinifiedEnumDescriptors } from '@sheetxl/scripting';
2
2
  declare const descriptors: MinifiedDescriptors;
3
+ export declare const enums: MinifiedEnumDescriptors;
3
4
  export default descriptors;
4
5
  //# sourceMappingURL=Reference.desc.d.ts.map
@@ -1,4 +1,5 @@
1
- import { MinifiedDescriptors } from '@sheetxl/scripting';
1
+ import { MinifiedDescriptors, MinifiedEnumDescriptors } from '@sheetxl/scripting';
2
2
  declare const descriptors: MinifiedDescriptors;
3
+ export declare const enums: MinifiedEnumDescriptors;
3
4
  export default descriptors;
4
5
  //# sourceMappingURL=Math.desc.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { IRange, Scalar } from '@sheetxl/primitives';
2
+ /**
3
+ * The reading the A functions apply to a member their plain twin skips — AVERAGEA, MAXA, MINA,
4
+ * STDEVA, STDEVPA, VARA and VARPA.
5
+ *
6
+ * Text and FALSE are 0, TRUE is 1, and a NUMERIC text is 0 rather than its number. All of it
7
+ * applies to a member of a REFERENCE; inside an ARRAY the A functions are their plain twins —
8
+ * `MAXA({-1,-2,"x"})` is -1 where MAXA over the same three CELLS is 0 — with one exception:
9
+ * AVERAGEA carries the text rule into an array as well, so `AVERAGEA({-1,-2,"x"})` is -1. A
10
+ * BOOLEAN in an array is skipped by every one of them, AVERAGEA included, typed or computed
11
+ * alike: `AVERAGEA({TRUE})` and `AVERAGEA(TRANSPOSE({TRUE}))` are both #DIV/0! while a TRUE CELL
12
+ * averages 1. The split is the reference-vs-array KIND, not literalness.
13
+ *
14
+ * A DIRECT argument never reaches any of this — those slots are typed `number`, so a boolean
15
+ * coerced to 1 and a text failed to #VALUE! before it was boxed.
16
+ *
17
+ * It lives here rather than beside the functions because an exported helper in a category
18
+ * directory registers a formula function, and both category files need it.
19
+ */
20
+ export declare const isReferenceRange: (range: IRange) => boolean;
21
+ /** MAXA, MINA, STDEVA, STDEVPA, VARA and VARPA. */
22
+ export declare const ValueOptionsAFunctions: IRange.ValueOptions;
23
+ /** AVERAGEA's, which differs in one place: a text member of an ARRAY is 0 rather than skipped. */
24
+ export declare const ValueOptionsAverageA: IRange.ValueOptions;
25
+ /**
26
+ * The same reading applied to a RAW member, for the bodies that need each deviation rather than
27
+ * an aggregate. `reference` is `isReferenceRange` of the range the value came out of.
28
+ */
29
+ export declare const coerceAValue: (v: Scalar, reference: boolean) => number | null;
30
+ //# sourceMappingURL=AValues.d.ts.map
@@ -6,7 +6,9 @@ import { IRange, IFormulaContext, IReferenceRange, Scalar } from '@sheetxl/primi
6
6
  * @param context - The formula context.
7
7
  * @param pairs - The `[criteriaRange, criteria]` groups to evaluate. Each criteria is a single
8
8
  * VALUE: the slot is declared `AcceptError<Scalar>`, so a range in that position is lifted by
9
- * the engine and this helper is called once per element.
9
+ * the engine and this helper is called once per element. `AcceptError` because an error is a
10
+ * MATCHABLE criterion, not a fault — `COUNTIF(J1:J3,1/0)` over a `#DIV/0!` cell is 1 and
11
+ * `SUMIF(J1:J3,NA(),J1:J3)` sums the matched `#N/A` cell.
10
12
  * @param aggregateFn - Called for each matching cell position with
11
13
  * `(accumulator, value)`. `accumulator` is `null` on the first matching call.
12
14
  * Return `accumulator` unchanged to skip a value (e.g. non-numeric).
@@ -31,9 +33,9 @@ import { IRange, IFormulaContext, IReferenceRange, Scalar } from '@sheetxl/primi
31
33
  *
32
34
  * Blanks keep their meaning through `emptyFold`: whether a blank matches is a constant per
33
35
  * criteria (`evaluator(null)`), so the blank positions contribute one term stated once rather
34
- * than a million evaluations. Measured, `COUNTIFS(A:A,"<>10")` is 1,048,576 and
36
+ * than a million evaluations. `COUNTIFS(A:A,"<>10")` is 1,048,576 and
35
37
  * `COUNTIFS(A:A,"<>10",B:B,">0")` is the handful B has members at — the second pair rejects
36
- * blanks, so the blank term drops out on its own (probe-criteria-blank.ps1).
38
+ * blanks, so the blank term drops out on its own.
37
39
  */
38
40
  export declare function aggregateIFS(context: IFormulaContext, pairs: readonly [criteriaRange: IReferenceRange | IRange, criteria: Scalar][], aggregateFn: (accumulator: Scalar, value: Scalar) => Scalar, aggRange: IRange | undefined, noMatchDefault: Scalar, emptyFold: ((accumulator: Scalar, count: number) => Scalar) | null): Scalar;
39
41
  //# sourceMappingURL=AggregateIFS.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Excel's arithmetic rules, for the bodies that have to reproduce them INSIDE a computation
3
+ * rather than at the boundary.
4
+ */
5
+ /**
6
+ * Zeroes a subnormal, and folds -0 to 0 with it.
7
+ *
8
+ * Excel flushes a subnormal at its MULTIPLYING operators and nowhere else — a function's result
9
+ * keeps one (`EXP(-745)` is 5E-324) and so do `+` and `-`. A body whose answer comes out of a
10
+ * DIVISION inherits the rule and has to say so here, because JavaScript's `/` does not:
11
+ * `ACOTH(1E307*17)` is 0 in Excel, where `1/1.7E308` is a subnormal that would otherwise survive
12
+ * the arctangent.
13
+ */
14
+ export declare const flushSubnormal: (value: number) => number;
15
+ /**
16
+ * The inverse hyperbolic tangent, decomposed the way a C library does it — the log form above
17
+ * half and `log1p` below — rather than through the platform's `Math.atanh`.
18
+ *
19
+ * It is the spelling Excel agrees with: `ATANH(0.5)` is 0.5493061443340549,
20
+ * which is `ln(3)/2`, where `Math.atanh(0.5)` is one ulp below; and ACOTH reaches it with
21
+ * `y = 1/x`, where the log form keeps precision the rounded reciprocal has already lost
22
+ * (`ACOTH(1.0000001)` is 8.405621440467199, and `Math.atanh(1/1.0000001)` is 8.40562144042724 —
23
+ * a difference of eleven digits, not of a bit).
24
+ */
25
+ export declare const atanhExcel: (y: number) => number;
26
+ /**
27
+ * A double read at 15 SIGNIFICANT DECIMAL DIGITS — the precision at which Excel reads one before
28
+ * deciding which side of a boundary it falls on.
29
+ *
30
+ * `INT(4.35*100)` is 435 where the double is 434.99999999999994, and `ROUND(50*0.57,0)` is 29
31
+ * because 28.4999999999999964 reads as 28.5. It is a PER-SLOT rule and not a global one — MOD,
32
+ * QUOTIENT, EVEN and ODD read the raw double at the same position their siblings read this — so a
33
+ * body applies it at the slots that read this way and nowhere else.
34
+ */
35
+ export declare const round15: (value: number) => number;
36
+ //# sourceMappingURL=Arithmetic.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `n!` the way Excel accumulates it: a DESCENDING double product, `n · (n-1) · … · 2`.
3
+ *
4
+ * The order is the whole of the rule. Ascending gives a different double on twenty-two of the
5
+ * integers in range, and the correctly rounded value is a third answer again.
6
+ */
7
+ export declare const factorialKernel: (n: number) => number;
8
+ /** The largest `number` COMBIN accepts: `2^31 - 2`, one short of INT_MAX. */
9
+ export declare const CombinMax = 2147483646;
10
+ /**
11
+ * `C(n,k)` as a multiplicative product rather than a ratio of factorials.
12
+ *
13
+ * That is why `COMBIN(171,85)` answers where `FACT(171)` is `#NUM!`, and why the refusal is on
14
+ * the ANSWER rather than the arguments: `COMBIN(1029,514)` is 1.43E308 and `COMBIN(1030,514)` is
15
+ * `#NUM!`. Dividing before multiplying keeps the running value in range, and the smaller of
16
+ * `k` and `n-k` decides the step count — `COMBIN(170,84)` and `COMBIN(170,86)` are the same
17
+ * double, not merely the same number.
18
+ */
19
+ export declare const binomialKernel: (n: number, k: number) => number;
20
+ //# sourceMappingURL=Combinatorics.d.ts.map
@@ -0,0 +1,94 @@
1
+ export declare const normalPdf: (x: number, mean: number, std: number) => number;
2
+ /**
3
+ * Taken through `erfc` rather than `1 + erf`: below about `-6` standard deviations the latter is
4
+ * one plus a value one ulp short of minus one, so the whole lower tail cancels away to zero
5
+ * where Excel carries it out to 1E-300.
6
+ */
7
+ export declare const normalCdf: (x: number, mean: number, std: number) => number;
8
+ export declare const normalInv: (p: number, mean: number, std: number) => number;
9
+ export declare function lognormalPdf(x: number, mu: number, sigma: number): number;
10
+ export declare function lognormalCdf(x: number, mu: number, sigma: number): number;
11
+ export declare const lognormalInv: (p: number, mu: number, sigma: number) => number;
12
+ export declare function gammaPdf(x: number, shape: number, scale: number): number;
13
+ export declare function gammaCdf(x: number, shape: number, scale: number): number;
14
+ export declare const gammaInv: (p: number, shape: number, scale: number) => number;
15
+ export declare function chisquarePdf(x: number, dof: number): number;
16
+ export declare function chisquareCdf(x: number, dof: number): number;
17
+ /** `1 - chisquareCdf`, taken from the tail itself rather than by subtracting it from one. */
18
+ export declare function chisquareCdfUpper(x: number, dof: number): number;
19
+ export declare const chisquareInv: (p: number, dof: number) => number;
20
+ export declare function centralFPdf(x: number, df1: number, df2: number): number;
21
+ export declare function centralFCdf(x: number, df1: number, df2: number): number;
22
+ /**
23
+ * `1 - centralFCdf`, as the incomplete beta's OTHER tail — argument and parameters both swapped,
24
+ * so the small quantity is the one computed. Subtracting the lower tail from one instead loses
25
+ * the whole answer once the tail is under an ulp of one.
26
+ */
27
+ export declare function centralFCdfUpper(x: number, df1: number, df2: number): number;
28
+ export declare const centralFInv: (p: number, df1: number, df2: number) => number;
29
+ export declare function studenttPdf(x: number, dof: number): number;
30
+ /**
31
+ * The argument is `dof/(dof + x^2)` rather than `(x + sqrt(x^2+dof))/(2 sqrt(x^2+dof))`: the
32
+ * latter is one minus a value the size of the ANSWER, so at `x = 1E7` it arrives as `1 - 2.5E-15`
33
+ * and the tail is gone before the kernel is called. Both spell the same function.
34
+ */
35
+ export declare function studenttCdf(x: number, dof: number): number;
36
+ /**
37
+ * `1 - studenttCdf`, from the tail itself — see {@link studenttCdf} for the argument.
38
+ *
39
+ * An `x` whose square overflows is refused rather than read as the limit. Excel refuses it too
40
+ * (`T.DIST(1E307,5,TRUE)` is `#NUM!` while `T.DIST(2^31,5,TRUE)` is 1), and the boundary is the
41
+ * same one: `x^2` past a double.
42
+ */
43
+ export declare function studenttCdfUpper(x: number, dof: number): number;
44
+ export declare function studenttInv(p: number, dof: number): number;
45
+ export declare function poissonPdf(k: number, l: number): number;
46
+ /**
47
+ * The CDF sums the mass function term by term, and adds the terms BACK TO FRONT.
48
+ *
49
+ * `x` is the caller's argument and the mass function divides by `k!`, so the walk answers only
50
+ * while every term is finite: past 170 the factorial overflows and a term is `Infinity`, `NaN`
51
+ * or a silently truncated tail. Where the walk cannot answer, the complementary regularized
52
+ * gamma is the same function in closed form.
53
+ *
54
+ * The ORDER is the one place this differs from the rest of the category, where Excel accumulates
55
+ * forward. It is kept because nothing separates the two orders: only nine of the family's rows
56
+ * move at all and they split between them, and a summation order should not be changed on a
57
+ * coin toss.
58
+ */
59
+ export declare function poissonCdf(x: number, l: number): number;
60
+ export declare const binomialPdf: (k: number, n: number, p: number) => number;
61
+ /**
62
+ * The CDF is the complement of a `1e-10` incomplete beta, ROUNDED to that same tolerance.
63
+ *
64
+ * The rounding is EXCEL'S, not a leftover: it is why a cumulative binomial in the bulk carries
65
+ * ten decimal places and no more. Taking it out moves answers AWAY from Excel — it costs sixty
66
+ * of BINOM.DIST's rows on its own — so it is not a cleanup to make.
67
+ */
68
+ export declare function binomialCdf(x: number, n: number, p: number): number;
69
+ export declare function negbinPdf(k: number, r: number, p: number): number;
70
+ /**
71
+ * `x` is the caller's argument, so the walk needs both an exit and a fallback: it stops once the
72
+ * tail has underflowed — the mass is unimodal, so a zero term is followed only by zero terms and
73
+ * the sum can no longer move — and hands over to the regularized incomplete beta, the same
74
+ * function in closed form, when a term overflows or the tail has not arrived by `NegbinMaxSteps`.
75
+ * A walk that never saw a NONZERO term hands over too: `p^r` underflows well before the answer
76
+ * does, so an all-zero walk measures the mass function's range and not the distribution.
77
+ */
78
+ export declare function negbinCdf(x: number, r: number, p: number): number;
79
+ export declare const exponentialPdf: (x: number, rate: number) => number;
80
+ export declare const exponentialCdf: (x: number, rate: number) => number;
81
+ export declare function betaPdf(x: number, alpha: number, beta: number): number;
82
+ export declare const betaCdf: (x: number, alpha: number, beta: number) => number;
83
+ export declare const betaInv: (p: number, alpha: number, beta: number) => number;
84
+ /**
85
+ * Half-width of the confidence interval around a mean, from the normal quantile.
86
+ *
87
+ * The `(1 + h) - 1` round trip is not redundant: it rounds the half-width against a unit
88
+ * magnitude, which moves the answer on most shapes. Whether Excel rounds there too is not
89
+ * established, so the round trip stays.
90
+ */
91
+ export declare function normalConfidence(alpha: number, standardDev: number, size: number): number;
92
+ /** The same half-width from Student's t on `size - 1` degrees of freedom. */
93
+ export declare function studenttConfidence(alpha: number, standardDev: number, size: number): number;
94
+ //# sourceMappingURL=Distributions.d.ts.map
@@ -1,23 +1,4 @@
1
- import { IRange, Scalar } from '@sheetxl/primitives';
2
- /**
3
- * Throws the first error member (row-major) — the in-body form of the engine's reject scan,
4
- * for functions that cannot use the engine's reject default. Call it once per range, in
5
- * ARGUMENT order, where a function takes several.
6
- *
7
- * Three reasons a function ends up here, all measured:
8
- * * its policy depends on a runtime argument (SUBTOTAL/AGGREGATE options),
9
- * * or on which rows matched (the database family),
10
- * * or one of its own verdicts OUTRANKS a member error, so the scan has to run after that check
11
- * rather than before the body. The count mismatch is the one that does this
12
- * (`CHISQ.TEST(<3 cells with an error>, <2 cells>)` is `#N/A`, not the error — the same rule
13
- * the SUMX2MY2 family and `PROB` follow); every other validation loses to the error and needs
14
- * no in-body scan at all.
15
- *
16
- * Those parameters declare `AcceptError` to keep the engine's reject default off; everything
17
- * with a static reject policy needs no marker at all. Callers hand UNTYPED ranges, so the read
18
- * is already raw.
19
- */
20
- export declare function throwFirstErrorMember(range: IRange): void;
1
+ import { Scalar } from '@sheetxl/primitives';
21
2
  /**
22
3
  * Wraps a value-aggregating reduce callback (SUMIF / AVERAGEIF / MAXIFS / …) so an error in a
23
4
  * MATCHED member becomes the whole result, while a non-matched one stays invisible.
@@ -0,0 +1,32 @@
1
+ import { IRange, Scalar } from '@sheetxl/primitives';
2
+ /**
3
+ * The answer for a CONTAINER at a slot that reads a multi-cell REFERENCE by its FIRST CELL while
4
+ * an array constant still answers per member — `N` and `T`.
5
+ *
6
+ * @remarks
7
+ * `T(AF1:AF3)` is `"alpha"` and stays a scalar —
8
+ * `ROWS` of it is 1 and `INDEX(…,2,1)` is `#REF!` — while `T({"alpha";"bravo"})` spills 2x1. Both
9
+ * names declare `IRange | Scalar`, so a value and a ONE-CELL reference never reach here (the
10
+ * marshaller dereferences them at the scalar arm, errors included); what arrives is a container,
11
+ * and only its KIND separates the two readings.
12
+ *
13
+ * `paramIndex` is the slot the kind is asked about — 0 for both of today's callers.
14
+ *
15
+ * An error at the first cell of a multi-cell reference propagates here, which is what a one-cell
16
+ * reference does (`T(<#N/A cell>)` is `#N/A`).
17
+ */
18
+ export declare const readFirstOrMembers: <T extends Scalar>(container: IRange, read: (value: Scalar) => T, paramIndex?: number) => T;
19
+ /**
20
+ * The one cell a multi-cell REFERENCE reads as at a slot Excel declares a plain VALUE.
21
+ *
22
+ * @remarks
23
+ * The choice is the call's implicit-intersection MODE: in VALUE
24
+ * mode the cell the formula's own row and column select — the `@` rule on both axes, `#VALUE!`
25
+ * when the formula cell lies outside the range — and in ARRAY mode the first cell. A one-cell
26
+ * reference is its own cell in either mode.
27
+ *
28
+ * `LeastSquares.readOneCell` in `@sheetxl/formulas-extended` is the same rule; the two packages
29
+ * share only `@sheetxl/primitives`, which is why there are two copies rather than one import.
30
+ */
31
+ export declare const readIntersectedCell: (range: IRange) => Scalar;
32
+ //# sourceMappingURL=FirstCell.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The elimination behind MDETERM and MINVERSE — LU with partial pivoting, and no tolerance
3
+ * anywhere in it.
4
+ *
5
+ * The determinant of a SINGULAR matrix is what makes the algorithm visible rather than a matter
6
+ * of taste: Excel answers 6.661338147750939E-16 for `MDETERM({1,2,3;4,5,6;7,8,9})`, exactly 0 for
7
+ * its transpose, and the same residue negated when its first two rows are swapped. Those are the
8
+ * numbers the elimination leaves; a body that cuts a small pivot to zero can produce none of
9
+ * them, and one without pivoting produces a different residue again.
10
+ *
11
+ * The inverse is this same decomposition followed by a forward and back SUBSTITUTION per unit
12
+ * column. Gauss-Jordan over `[A | I]` — the textbook alternative, and in five spellings — lands
13
+ * further from Excel on the same matrices.
14
+ */
15
+ /**
16
+ * The determinant, as the signed product of the pivots.
17
+ *
18
+ * The product is a multiplication, so it carries the two rules Excel's multiplying operators do:
19
+ * a subnormal flushes to zero (`MDETERM({1E-160,2E-160;3E-160,4E-160})` is 0, not 2E-320) and an
20
+ * overflow is `#NUM!` rather than an infinity, which is what `NaN` means to the caller.
21
+ */
22
+ export declare const determinant: (m: readonly (readonly number[])[]) => number;
23
+ /**
24
+ * The inverse, one unit column at a time. `null` when a pivot was zero — the caller's `#NUM!`.
25
+ *
26
+ * The substitution subtracts term by term rather than accumulating a sum and subtracting once;
27
+ * the two differ in the last bit wherever the terms cancel, and only the first reproduces
28
+ * Excel's `MINVERSE({1,2;3,4})`, which is not the exact `[[-2,1],[1.5,-0.5]]`.
29
+ */
30
+ export declare const invert: (m: readonly (readonly number[])[]) => number[][] | null;
31
+ //# sourceMappingURL=Matrix.d.ts.map
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Log-gamma. Lanczos with `g = 671/128` and fourteen coefficients.
3
+ *
4
+ * The six-coefficient form this was seeded with holds about ten digits, and every function here
5
+ * reads its answer through an `exp`, so those ten were the ceiling under the whole distribution
6
+ * library — `ibetainv` cannot find a root more accurately than the `ibeta` it is inverting.
7
+ */
8
+ export declare function gammaln(x: number): number;
9
+ /** Gamma, by the rational approximation — `Infinity` past the double's last representable value. */
10
+ export declare function gammafn(x: number): number;
11
+ /** The beta function. */
12
+ export declare function betafn(x: number, y: number): number | undefined;
13
+ /** The argument above which {@link stirlerr}'s series is good to the last bit. */
14
+ export declare const StirlingFloor = 30;
15
+ /**
16
+ * `ln B(x, y)`.
17
+ *
18
+ * `ln G(x) + ln G(y) - ln G(x + y)` is a difference of large numbers whenever either argument is
19
+ * large, and the answer is not large — the loss is total enough to be the whole story behind the
20
+ * F and t families' five-digit plateau at a degrees of freedom of 1E10. Above
21
+ * {@link StirlingFloor} the larger argument is folded into {@link lgammaDelta} instead, which
22
+ * never forms it. Below it the expression is the original one, so nothing else changes.
23
+ */
24
+ export declare const betaln: (x: number, y: number) => number;
25
+ /** The error function, by Chebyshev approximation. */
26
+ export declare const erf: (x: number) => number;
27
+ /** The complementary error function. */
28
+ export declare const erfc: (x: number) => number;
29
+ /** The inverse of {@link erfc}. */
30
+ export declare function erfcinv(p: number): number;
31
+ /**
32
+ * The lower regularized incomplete gamma, `P(a, x)`.
33
+ *
34
+ * The iteration count is a formula rather than a convergence test — both branches simply run
35
+ * `ITMAX` times. The cap is sized from the shape, so both also stop as soon as the accumulator
36
+ * has stopped moving; without that a large shape walks the cap one term at a time for no gain
37
+ * (a shape of 1e9 takes ten seconds).
38
+ *
39
+ * Past {@link TemmeShape} neither branch is asked at all — see {@link temmeQ}.
40
+ */
41
+ export declare const lowRegGamma: (a: number, x: number) => number;
42
+ /**
43
+ * `Q(a, x) = 1 - P(a, x)`, on the branch that does not cancel.
44
+ *
45
+ * The continued fraction computes `Q` and the series computes `P`, so spelling either one as
46
+ * `1 -` the other throws the smaller of the two away — for a far tail that is the entire answer.
47
+ */
48
+ export declare const upRegGamma: (a: number, x: number) => number;
49
+ /**
50
+ * `ln` of the `Gamma(a, 1)` density at `x`, written so that nothing in it cancels.
51
+ *
52
+ * The direct spelling `(a-1) ln x - x - ln G(a)` is a sum of terms the size of `a ln a` — 1.6E8
53
+ * at a shape of 1E7 — that has to come out near zero, so it holds seven digits there whatever
54
+ * `ln G` is asked. Folding Stirling's form for `ln G(a)` in symbolically leaves
55
+ *
56
+ * ```
57
+ * -a (u - ln(1+u)) - ln(1+u) - ln(a)/2 - ln(2 pi)/2 - stirlerr(a), u = x/a - 1
58
+ * ```
59
+ *
60
+ * whose every term is the size of the answer. Excel's own `GAMMA.DIST(1E7,1E7,1,FALSE)` is bit
61
+ * for bit the value this returns, so it is what Excel computes too.
62
+ */
63
+ export declare function gammaLogPdf(a: number, x: number): number;
64
+ /** The inverse of {@link lowRegGamma} in its second argument. */
65
+ export declare function gammapinv(p: number, a: number): number;
66
+ /**
67
+ * The continued fraction of the incomplete beta, by modified Lentz's method.
68
+ *
69
+ * The stop is an ulp of the ratio. The single-precision `3e-7` it was seeded with put a floor
70
+ * under every F and t answer at about seven digits — visible wherever a body asked for eight.
71
+ */
72
+ export declare function betacf(x: number, a: number, b: number): number;
73
+ /**
74
+ * The regularized incomplete beta, `I_x(a, b)`.
75
+ *
76
+ * The front factor goes through {@link betaln}, which does not cancel at a large argument.
77
+ */
78
+ export declare const ibeta: (x: number, a: number, b: number) => number;
79
+ /**
80
+ * `I_x(a, b)` where the caller supplies `1 - x` as well as `x`.
81
+ *
82
+ * A caller that has both in closed form has a far better `1 - x` than the subtraction does: an
83
+ * `x` of `dof/(dof + t^2)` is `1 - 2.25E-10` at a degrees of freedom of 1E10, and recovering
84
+ * that complement by subtracting leaves six of its digits, which is the whole answer on this
85
+ * branch. {@link ibeta} passes the subtraction, which is all there is to pass when `x` is what
86
+ * the caller was given.
87
+ */
88
+ export declare function ibetaAt(x: number, cx: number, a: number, b: number): number;
89
+ /** The inverse of {@link ibeta} in its first argument. */
90
+ export declare function ibetainv(p: number, a: number, b: number): number;
91
+ //# sourceMappingURL=SpecialFunctions.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Excel's circular trigonometry, which is not the platform library's.
3
+ *
4
+ * Excel's `SIN` `COS` `TAN` disagree with a correctly-rounded library in the FOURTH significant
5
+ * digit near a multiple of pi/2 — `SIN(PI())` is 1.22514845490862E-16 where the true sine of the
6
+ * double `PI()` is 1.2246467991473532E-16 — because Excel reduces the argument against pi
7
+ * ROUNDED TO A 64-BIT SIGNIFICAND (the x87 80-bit extended constant) rather than against pi. The
8
+ * difference is a constant, not noise to be tolerated at 15 digits.
9
+ *
10
+ * The reduction has to be carried at more than double precision: `k` reaches 2^27/(pi/2), about
11
+ * 8.5E7, so `k * PI_HI/2` needs the exact product rather than the rounded one. That is what the
12
+ * double-double helpers below are for. The answer is re-evaluated from the reduced argument
13
+ * rather than perturbed from the library's: perturbing keeps the ordinary arguments exact and
14
+ * loses the reduced ones.
15
+ */
16
+ /** `|x|` at or above which Excel refuses a circular trig argument outright. */
17
+ export declare const MAX_TRIG_ARGUMENT: number;
18
+ /** Excel's sine. The caller owns the {@link MAX_TRIG_ARGUMENT} refusal. */
19
+ export declare function x87Sin(x: number): number;
20
+ /** Excel's cosine. The caller owns the {@link MAX_TRIG_ARGUMENT} refusal. */
21
+ export declare function x87Cos(x: number): number;
22
+ /**
23
+ * Excel's tangent, which is the quotient of the two above and not a function of its own.
24
+ * `TAN(x)` is exactly `SIN(x)/COS(x)` everywhere, including at the poles, where the quotient is
25
+ * what produces the large finite answer (`TAN(PI()/2)` is 1.6324552277619072E16).
26
+ */
27
+ export declare const x87Tan: (x: number) => number;
28
+ //# sourceMappingURL=X87.d.ts.map