@danielsimonjr/mathts-core 0.11.0 → 0.12.0

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.
@@ -458,11 +458,19 @@ var Complex = class _Complex {
458
458
  return this.add(this.multiply(this).add(one).sqrt()).log();
459
459
  }
460
460
  /**
461
- * Inverse hyperbolic cosine: acosh(z) = ln(z + √(z² - 1))
461
+ * Inverse hyperbolic cosine: acosh(z) = ln(z + √(z-1)·√(z+1))
462
+ *
463
+ * The principal value has non-negative real part (C99 Annex G / DLMF 4.37 /
464
+ * NumPy convention). Using the factored `√(z-1)·√(z+1)` rather than `√(z²-1)`
465
+ * selects the correct Riemann sheet for Re(z) < 0 and on the real-axis branch
466
+ * cuts (z < 1), where `√(z²-1)` lands on the wrong branch — the previous form
467
+ * returned a negative real part (e.g. acosh(-1+0.5i)) and the wrong sign of π
468
+ * on z < -1.
462
469
  */
463
470
  acosh() {
464
471
  const one = new _Complex(1, 0);
465
- return this.add(this.multiply(this).subtract(one).sqrt()).log();
472
+ const s = this.subtract(one).sqrt().multiply(this.add(one).sqrt());
473
+ return this.add(s).log();
466
474
  }
467
475
  /**
468
476
  * Inverse hyperbolic tangent: atanh(z) = (1/2)·ln((1 + z)/(1 - z))
@@ -2454,10 +2462,13 @@ var BigNumber = class _BigNumber {
2454
2462
  if (this._sign === 0) return new _BigNumber(0, 0n, 0);
2455
2463
  const sign2 = this._sign * b._sign;
2456
2464
  const precision = globalConfig.precision;
2457
- const scale = BigInt(10) ** BigInt(precision + 10);
2465
+ const aDigits = this._coefficient.toString().length;
2466
+ const bDigits = b._coefficient.toString().length;
2467
+ const scaleDigits = precision + 10 + Math.max(0, bDigits - aDigits);
2468
+ const scale = BigInt(10) ** BigInt(scaleDigits);
2458
2469
  const scaledDividend = this._coefficient * scale;
2459
2470
  const quotient = scaledDividend / b._coefficient;
2460
- const exponent = this._exponent - b._exponent - precision - 10;
2471
+ const exponent = this._exponent - b._exponent - scaleDigits;
2461
2472
  return this.normalize(sign2, quotient, exponent).roundToPrecision(precision);
2462
2473
  }
2463
2474
  /**
@@ -6432,6 +6443,7 @@ export {
6432
6443
  BIGNUMBER_E,
6433
6444
  BIGNUMBER_LN2,
6434
6445
  BIGNUMBER_LN10,
6446
+ DEFAULT_CONFIG,
6435
6447
  addScalar,
6436
6448
  subtractScalar,
6437
6449
  multiplyScalar,
package/dist/index.d.ts CHANGED
@@ -355,7 +355,14 @@ declare class Complex implements IComplex {
355
355
  */
356
356
  asinh(): Complex;
357
357
  /**
358
- * Inverse hyperbolic cosine: acosh(z) = ln(z + √(z² - 1))
358
+ * Inverse hyperbolic cosine: acosh(z) = ln(z + √(z-1)·√(z+1))
359
+ *
360
+ * The principal value has non-negative real part (C99 Annex G / DLMF 4.37 /
361
+ * NumPy convention). Using the factored `√(z-1)·√(z+1)` rather than `√(z²-1)`
362
+ * selects the correct Riemann sheet for Re(z) < 0 and on the real-axis branch
363
+ * cuts (z < 1), where `√(z²-1)` lands on the wrong branch — the previous form
364
+ * returned a negative real part (e.g. acosh(-1+0.5i)) and the wrong sign of π
365
+ * on z < -1.
359
366
  */
360
367
  acosh(): Complex;
361
368
  /**
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  round,
45
45
  sign,
46
46
  subtractScalar
47
- } from "./chunk-PALIR4V6.js";
47
+ } from "./chunk-7BUNGMQB.js";
48
48
 
49
49
  // src/types/matrix/Range.ts
50
50
  var name = "Range";
@@ -479,6 +479,23 @@ declare function pick(object: Record<string, unknown>, properties: string[], tra
479
479
  */
480
480
  declare function pickShallow(object: Record<string, unknown>, properties: string[]): Record<string, unknown>;
481
481
 
482
+ /**
483
+ * Configuration interface for math.js
484
+ */
485
+ interface ConfigOptions {
486
+ relTol: number;
487
+ absTol: number;
488
+ matrix: 'Matrix' | 'Array';
489
+ number: 'number' | 'BigNumber' | 'bigint' | 'Fraction';
490
+ numberFallback: 'number' | 'BigNumber';
491
+ precision: number;
492
+ predictable: boolean;
493
+ randomSeed: string | null;
494
+ legacySubset: boolean;
495
+ }
496
+ type MathJsConfig = ConfigOptions;
497
+ declare const DEFAULT_CONFIG: ConfigOptions;
498
+
482
499
  /**
483
500
  * Custom error type for Mathjs errors
484
501
  * @extends Error
@@ -1185,4 +1202,39 @@ declare function assign<K = unknown, V = unknown>(map: Map<K, V>, ...objects: (M
1185
1202
  */
1186
1203
  declare function isObjectWrappingMap(object: unknown): object is ObjectWrappingMap;
1187
1204
 
1188
- export { type BigNumberValue, DimensionError, FactoryFunction, type FormatOptions, type GeneralFormatOptions, type IdentifiedValue, Index, IndexError, MathjsError, Matrix$1 as Matrix, type MemoizedFunction, type NestedArray, type NormalizedFormatOptions, type NumberTypeConfig, ObjectWrappingMap, PartitionedMap, type SplitValue, UnitConstructor, UnitDependencies, acosh, arraySize, asinh, assign as assignMap, atanh, broadcastArrays, broadcastSizes, broadcastTo, canDefineProperty, cbrt, checkBroadcastingRules, clone$1 as clone, clone as cloneArray, compareText, concat, containsCollections, copysign, cosh, createEmptyMap, createIndexError, createMap, createUnitClass, deepExtend, deepFlatten, deepForEach, deepForEach$1 as deepForEachArray, deepMap, deepMap$1 as deepMapArray, deepStrictEqual, digits, endsWith, escape, expm1, extend, filter, filterRegExp, flatten, forEach, format$2 as format, format as formatBigNumber, format$1 as formatGeneric, generalize, get$1 as get, getArrayDataType, get as getArrayElement, hasOwnProperty, identify, initial, isEmptyIndex, isInteger, isLegacyFactory, isObjectWrappingMap, isPowZeroAtInfinity, join, last, lazy, log10, log1p, log2, map, mapObject, memoize, nearlyEqual, normalizeFormatOptions, pick, pickShallow, processSizesWildcard, reduce, reshape, resize, roundDigits, safeNumberType, scatter, set, sign, sinh, splitNumber, squeeze, stretch, stringify, tanh, toEngineering$1 as toEngineering, toEngineering as toEngineeringBigNumber, toExponential$1 as toExponential, toExponential as toExponentialBigNumber, toFixed$1 as toFixed, toFixed as toFixedBigNumber, toObject, toPrecision, traverse, unitDependencies, unsqueeze, validate, validateIndex, validateIndexSourceSize, warnOnce };
1205
+ /**
1206
+ * Shared type-only shapes for the two independent WASM loader implementations
1207
+ * (`functions/src/wasm/WasmLoader.ts` and `matrix/src/backends/WasmLoader.ts`).
1208
+ *
1209
+ * Both packages bind to the same `mathts-as.wasm` AssemblyScript binary but each
1210
+ * declares its own package-scoped subset of the exported function ABI (`WasmModule`
1211
+ * genuinely differs between the two — matrix only needs matrix-relevant exports,
1212
+ * functions needs the full breadth including signal/geometry/special-function
1213
+ * kernels — so `WasmModule` stays local to each package). `LoadingMetrics` (perf
1214
+ * timings) and `WasmManifest` (the SHA-384 integrity manifest shape) were,
1215
+ * however, byte-for-byte identical copies with no principled reason to diverge;
1216
+ * consolidated here (cross-package type-dedup pass,
1217
+ * docs/Architecture/duplicate-symbols.json).
1218
+ *
1219
+ * @module @danielsimonjr/mathts-core/types/wasm-loader
1220
+ */
1221
+ /**
1222
+ * Loading performance metrics for a WASM module load/instantiate cycle.
1223
+ */
1224
+ interface LoadingMetrics {
1225
+ fileReadMs: number;
1226
+ compileMs: number;
1227
+ instantiateMs: number;
1228
+ totalMs: number;
1229
+ fromCache: boolean;
1230
+ }
1231
+ /**
1232
+ * SHA-384 integrity manifest: maps a `.wasm` filename to its
1233
+ * `"sha384-<base64 digest>"` value (SRI-style), as generated by
1234
+ * `tools/generate-wasm-manifest.mjs`.
1235
+ */
1236
+ interface WasmManifest {
1237
+ [fileName: string]: string;
1238
+ }
1239
+
1240
+ export { type BigNumberValue, type ConfigOptions, DEFAULT_CONFIG, DimensionError, FactoryFunction, type FormatOptions, type GeneralFormatOptions, type IdentifiedValue, Index, IndexError, type LoadingMetrics, type MathJsConfig, MathjsError, Matrix$1 as Matrix, type MemoizedFunction, type NestedArray, type NormalizedFormatOptions, type NumberTypeConfig, ObjectWrappingMap, PartitionedMap, type SplitValue, UnitConstructor, UnitDependencies, type WasmManifest, acosh, arraySize, asinh, assign as assignMap, atanh, broadcastArrays, broadcastSizes, broadcastTo, canDefineProperty, cbrt, checkBroadcastingRules, clone$1 as clone, clone as cloneArray, compareText, concat, containsCollections, copysign, cosh, createEmptyMap, createIndexError, createMap, createUnitClass, deepExtend, deepFlatten, deepForEach, deepForEach$1 as deepForEachArray, deepMap, deepMap$1 as deepMapArray, deepStrictEqual, digits, endsWith, escape, expm1, extend, filter, filterRegExp, flatten, forEach, format$2 as format, format as formatBigNumber, format$1 as formatGeneric, generalize, get$1 as get, getArrayDataType, get as getArrayElement, hasOwnProperty, identify, initial, isEmptyIndex, isInteger, isLegacyFactory, isObjectWrappingMap, isPowZeroAtInfinity, join, last, lazy, log10, log1p, log2, map, mapObject, memoize, nearlyEqual, normalizeFormatOptions, pick, pickShallow, processSizesWildcard, reduce, reshape, resize, roundDigits, safeNumberType, scatter, set, sign, sinh, splitNumber, squeeze, stretch, stringify, tanh, toEngineering$1 as toEngineering, toEngineering as toEngineeringBigNumber, toExponential$1 as toExponential, toExponential as toExponentialBigNumber, toFixed$1 as toFixed, toFixed as toFixedBigNumber, toObject, toPrecision, traverse, unitDependencies, unsqueeze, validate, validateIndex, validateIndexSourceSize, warnOnce };
package/dist/internal.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ DEFAULT_CONFIG,
2
3
  MathjsError,
3
4
  Unit,
4
5
  acosh,
@@ -77,7 +78,7 @@ import {
77
78
  typeOf,
78
79
  unitDependencies,
79
80
  warnOnce
80
- } from "./chunk-PALIR4V6.js";
81
+ } from "./chunk-7BUNGMQB.js";
81
82
 
82
83
  // src/error/DimensionError.ts
83
84
  var DimensionError = class _DimensionError extends RangeError {
@@ -1353,6 +1354,7 @@ function isObjectWrappingMap(object) {
1353
1354
  }
1354
1355
  export {
1355
1356
  Unit as CoreUnit,
1357
+ DEFAULT_CONFIG,
1356
1358
  DimensionError,
1357
1359
  IndexError,
1358
1360
  MathjsError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-core",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Core types, utilities, and configuration for MathTS",
5
5
  "author": "Daniel Simon Jr.",
6
6
  "license": "MIT",