@danielsimonjr/mathts-core 0.14.0 → 0.14.1

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.
@@ -19,7 +19,15 @@ var Complex = class _Complex {
19
19
  * @param theta - angle in radians
20
20
  */
21
21
  static fromPolar(r, theta) {
22
- return new _Complex(r * Math.cos(theta), r * Math.sin(theta));
22
+ const cosT = Math.cos(theta);
23
+ const sinT = Math.sin(theta);
24
+ let re = r * cosT;
25
+ let im = r * sinT;
26
+ if (!Number.isFinite(r) && !Number.isNaN(r)) {
27
+ if (cosT === 0) re = cosT;
28
+ if (sinT === 0) im = sinT;
29
+ }
30
+ return new _Complex(re, im);
23
31
  }
24
32
  /**
25
33
  * Create a Complex from a real number
@@ -4459,83 +4467,87 @@ var createUnitClass = /* @__PURE__ */ factory(
4459
4467
  "LUMINOUS_INTENSITY",
4460
4468
  "AMOUNT_OF_SUBSTANCE",
4461
4469
  "ANGLE",
4462
- "BIT"
4470
+ "BIT",
4471
+ "SOLID_ANGLE"
4463
4472
  ];
4464
4473
  const BASE_UNITS = {
4465
4474
  NONE: {
4466
- dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 0]
4475
+ dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
4467
4476
  },
4468
4477
  MASS: {
4469
- dimensions: [1, 0, 0, 0, 0, 0, 0, 0, 0]
4478
+ dimensions: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
4470
4479
  },
4471
4480
  LENGTH: {
4472
- dimensions: [0, 1, 0, 0, 0, 0, 0, 0, 0]
4481
+ dimensions: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
4473
4482
  },
4474
4483
  TIME: {
4475
- dimensions: [0, 0, 1, 0, 0, 0, 0, 0, 0]
4484
+ dimensions: [0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
4476
4485
  },
4477
4486
  CURRENT: {
4478
- dimensions: [0, 0, 0, 1, 0, 0, 0, 0, 0]
4487
+ dimensions: [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
4479
4488
  },
4480
4489
  TEMPERATURE: {
4481
- dimensions: [0, 0, 0, 0, 1, 0, 0, 0, 0]
4490
+ dimensions: [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
4482
4491
  },
4483
4492
  LUMINOUS_INTENSITY: {
4484
- dimensions: [0, 0, 0, 0, 0, 1, 0, 0, 0]
4493
+ dimensions: [0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
4485
4494
  },
4486
4495
  AMOUNT_OF_SUBSTANCE: {
4487
- dimensions: [0, 0, 0, 0, 0, 0, 1, 0, 0]
4496
+ dimensions: [0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
4488
4497
  },
4489
4498
  FORCE: {
4490
- dimensions: [1, 1, -2, 0, 0, 0, 0, 0, 0]
4499
+ dimensions: [1, 1, -2, 0, 0, 0, 0, 0, 0, 0]
4491
4500
  },
4492
4501
  SURFACE: {
4493
- dimensions: [0, 2, 0, 0, 0, 0, 0, 0, 0]
4502
+ dimensions: [0, 2, 0, 0, 0, 0, 0, 0, 0, 0]
4494
4503
  },
4495
4504
  VOLUME: {
4496
- dimensions: [0, 3, 0, 0, 0, 0, 0, 0, 0]
4505
+ dimensions: [0, 3, 0, 0, 0, 0, 0, 0, 0, 0]
4497
4506
  },
4498
4507
  ENERGY: {
4499
- dimensions: [1, 2, -2, 0, 0, 0, 0, 0, 0]
4508
+ dimensions: [1, 2, -2, 0, 0, 0, 0, 0, 0, 0]
4500
4509
  },
4501
4510
  POWER: {
4502
- dimensions: [1, 2, -3, 0, 0, 0, 0, 0, 0]
4511
+ dimensions: [1, 2, -3, 0, 0, 0, 0, 0, 0, 0]
4503
4512
  },
4504
4513
  PRESSURE: {
4505
- dimensions: [1, -1, -2, 0, 0, 0, 0, 0, 0]
4514
+ dimensions: [1, -1, -2, 0, 0, 0, 0, 0, 0, 0]
4506
4515
  },
4507
4516
  ELECTRIC_CHARGE: {
4508
- dimensions: [0, 0, 1, 1, 0, 0, 0, 0, 0]
4517
+ dimensions: [0, 0, 1, 1, 0, 0, 0, 0, 0, 0]
4509
4518
  },
4510
4519
  ELECTRIC_CAPACITANCE: {
4511
- dimensions: [-1, -2, 4, 2, 0, 0, 0, 0, 0]
4520
+ dimensions: [-1, -2, 4, 2, 0, 0, 0, 0, 0, 0]
4512
4521
  },
4513
4522
  ELECTRIC_POTENTIAL: {
4514
- dimensions: [1, 2, -3, -1, 0, 0, 0, 0, 0]
4523
+ dimensions: [1, 2, -3, -1, 0, 0, 0, 0, 0, 0]
4515
4524
  },
4516
4525
  ELECTRIC_RESISTANCE: {
4517
- dimensions: [1, 2, -3, -2, 0, 0, 0, 0, 0]
4526
+ dimensions: [1, 2, -3, -2, 0, 0, 0, 0, 0, 0]
4518
4527
  },
4519
4528
  ELECTRIC_INDUCTANCE: {
4520
- dimensions: [1, 2, -2, -2, 0, 0, 0, 0, 0]
4529
+ dimensions: [1, 2, -2, -2, 0, 0, 0, 0, 0, 0]
4521
4530
  },
4522
4531
  ELECTRIC_CONDUCTANCE: {
4523
- dimensions: [-1, -2, 3, 2, 0, 0, 0, 0, 0]
4532
+ dimensions: [-1, -2, 3, 2, 0, 0, 0, 0, 0, 0]
4524
4533
  },
4525
4534
  MAGNETIC_FLUX: {
4526
- dimensions: [1, 2, -2, -1, 0, 0, 0, 0, 0]
4535
+ dimensions: [1, 2, -2, -1, 0, 0, 0, 0, 0, 0]
4527
4536
  },
4528
4537
  MAGNETIC_FLUX_DENSITY: {
4529
- dimensions: [1, 0, -2, -1, 0, 0, 0, 0, 0]
4538
+ dimensions: [1, 0, -2, -1, 0, 0, 0, 0, 0, 0]
4530
4539
  },
4531
4540
  FREQUENCY: {
4532
- dimensions: [0, 0, -1, 0, 0, 0, 0, 0, 0]
4541
+ dimensions: [0, 0, -1, 0, 0, 0, 0, 0, 0, 0]
4533
4542
  },
4534
4543
  ANGLE: {
4535
- dimensions: [0, 0, 0, 0, 0, 0, 0, 1, 0]
4544
+ dimensions: [0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
4536
4545
  },
4537
4546
  BIT: {
4538
- dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1]
4547
+ dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
4548
+ },
4549
+ SOLID_ANGLE: {
4550
+ dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
4539
4551
  }
4540
4552
  };
4541
4553
  for (const key in BASE_UNITS) {
@@ -5450,9 +5462,21 @@ var createUnitClass = /* @__PURE__ */ factory(
5450
5462
  value: 1,
5451
5463
  offset: 0
5452
5464
  },
5453
- // TODO: units STERADIAN
5454
- // {name: 'sr', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0},
5455
- // {name: 'steradian', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0},
5465
+ // Solid angle
5466
+ sr: {
5467
+ name: "sr",
5468
+ base: BASE_UNITS.SOLID_ANGLE,
5469
+ prefixes: PREFIXES.NONE,
5470
+ value: 1,
5471
+ offset: 0
5472
+ },
5473
+ steradian: {
5474
+ name: "steradian",
5475
+ base: BASE_UNITS.SOLID_ANGLE,
5476
+ prefixes: PREFIXES.LONG,
5477
+ value: 1,
5478
+ offset: 0
5479
+ },
5456
5480
  // Force
5457
5481
  N: {
5458
5482
  name: "N",
@@ -5962,6 +5986,7 @@ var createUnitClass = /* @__PURE__ */ factory(
5962
5986
  LUMINOUS_INTENSITY: { unit: UNITS.cd, prefix: PREFIXES.SHORT[""] },
5963
5987
  AMOUNT_OF_SUBSTANCE: { unit: UNITS.mol, prefix: PREFIXES.SHORT[""] },
5964
5988
  ANGLE: { unit: UNITS.rad, prefix: PREFIXES.SHORT[""] },
5989
+ SOLID_ANGLE: { unit: UNITS.sr, prefix: PREFIXES.NONE[""] },
5965
5990
  BIT: { unit: UNITS.bits, prefix: PREFIXES.SHORT[""] },
5966
5991
  // Derived units
5967
5992
  FORCE: { unit: UNITS.N, prefix: PREFIXES.SHORT[""] },
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  round,
45
45
  sign,
46
46
  subtractScalar
47
- } from "./chunk-YZN52XIQ.js";
47
+ } from "./chunk-VPK5YTKG.js";
48
48
 
49
49
  // src/types/matrix/Range.ts
50
50
  var name = "Range";
@@ -1321,7 +1321,7 @@ function neumaierCumsum(xs, out) {
1321
1321
  }
1322
1322
 
1323
1323
  // src/index.ts
1324
- var VERSION = "0.14.0";
1324
+ var VERSION = "0.14.1";
1325
1325
  export {
1326
1326
  ALL_UNITS,
1327
1327
  BASE_UNITS,
package/dist/internal.js CHANGED
@@ -78,7 +78,7 @@ import {
78
78
  typeOf,
79
79
  unitDependencies,
80
80
  warnOnce
81
- } from "./chunk-YZN52XIQ.js";
81
+ } from "./chunk-VPK5YTKG.js";
82
82
 
83
83
  // src/error/DimensionError.ts
84
84
  var DimensionError = class _DimensionError extends RangeError {
package/package.json CHANGED
@@ -1,59 +1,59 @@
1
- {
2
- "name": "@danielsimonjr/mathts-core",
3
- "version": "0.14.0",
4
- "description": "Core types, utilities, and configuration for MathTS",
5
- "author": "Daniel Simon Jr.",
6
- "license": "MIT",
7
- "type": "module",
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
15
- },
16
- "./internal": {
17
- "import": "./dist/internal.js",
18
- "types": "./dist/internal.d.ts"
19
- }
20
- },
21
- "files": [
22
- "dist",
23
- "README.md"
24
- ],
25
- "scripts": {
26
- "build": "tsup",
27
- "dev": "tsup --watch",
28
- "test": "vitest run",
29
- "test:watch": "vitest",
30
- "test:coverage": "vitest run --coverage",
31
- "typecheck": "tsc --noEmit",
32
- "lint": "eslint src --ext .ts",
33
- "lint:fix": "eslint src --ext .ts --fix",
34
- "clean": "rm -rf dist",
35
- "build:prod": "tsup --minify --treeshake"
36
- },
37
- "dependencies": {
38
- "typed-function": "github:danielsimonjr/typed-function"
39
- },
40
- "devDependencies": {
41
- "@types/node": "^25.5.2",
42
- "tsup": "^8.0.0",
43
- "typescript": "^5.3.0",
44
- "vitest": "^4.1.5"
45
- },
46
- "publishConfig": {
47
- "access": "public"
48
- },
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/danielsimonjr/MathTS.git",
52
- "directory": "core"
53
- },
54
- "keywords": [
55
- "math",
56
- "typescript",
57
- "core"
58
- ]
59
- }
1
+ {
2
+ "name": "@danielsimonjr/mathts-core",
3
+ "version": "0.14.1",
4
+ "description": "Core types, utilities, and configuration for MathTS",
5
+ "author": "Daniel Simon Jr.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./internal": {
17
+ "import": "./dist/internal.js",
18
+ "types": "./dist/internal.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "dev": "tsup --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "test:coverage": "vitest run --coverage",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint src --ext .ts",
33
+ "lint:fix": "eslint src --ext .ts --fix",
34
+ "clean": "rm -rf dist",
35
+ "build:prod": "tsup --minify --treeshake"
36
+ },
37
+ "dependencies": {
38
+ "typed-function": "github:danielsimonjr/typed-function"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^25.5.2",
42
+ "tsup": "^8.0.0",
43
+ "typescript": "^5.3.0",
44
+ "vitest": "^4.1.10"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/danielsimonjr/MathTS.git",
52
+ "directory": "core"
53
+ },
54
+ "keywords": [
55
+ "math",
56
+ "typescript",
57
+ "core"
58
+ ]
59
+ }