cmath-js 5.1.0 → 5.2.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.
package/README.md CHANGED
@@ -6,8 +6,10 @@ Implementation of parts of C++'s numerics libraries in TypeScript/JavaScript, in
6
6
 
7
7
  - [`copysign`](https://en.cppreference.com/w/c/numeric/math/copysign)
8
8
  - [`fabs`](https://en.cppreference.com/w/c/numeric/math/fabs)
9
+ - [`fpclassify`](https://en.cppreference.com/c/numeric/math/fpclassify)
9
10
  - [`frexp`](https://en.cppreference.com/w/c/numeric/math/frexp)
10
11
  - [`hypot`](https://en.cppreference.com/w/cpp/numeric/math/hypot)
12
+ - [`iscanonical`](https://en.cppreference.com/w/c/numeric/math/frexp)
11
13
  - [`ldexp`](https://en.cppreference.com/w/c/numeric/math/ldexp)
12
14
  - [`nan`](https://en.cppreference.com/w/c/numeric/math/nan)
13
15
  - [`nextafter`](https://en.cppreference.com/w/c/numeric/math/nextafter)
@@ -0,0 +1,2 @@
1
+ import { type FPClassification } from "./macros.ts";
2
+ export declare function fpclassify(num: number): FPClassification;
@@ -0,0 +1,17 @@
1
+ import { FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, } from "./macros.js";
2
+ export function fpclassify(num) {
3
+ if (Number.isNaN(num)) {
4
+ return FP_NAN;
5
+ }
6
+ if (num === 0) {
7
+ return FP_ZERO;
8
+ }
9
+ if (Math.abs(num) < 2 ** -1022) {
10
+ return FP_SUBNORMAL;
11
+ }
12
+ if (Number.isFinite(num)) {
13
+ return FP_NORMAL;
14
+ }
15
+ return FP_INFINITE;
16
+ }
17
+ //# sourceMappingURL=fpclassify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fpclassify.js","sourceRoot":"","sources":["../../../src/namespace-std/doubles/fpclassify.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,MAAM,EACN,SAAS,EACT,YAAY,EACZ,OAAO,GAEP,MAAM,aAAa,CAAC;AAarB,MAAM,UAAU,UAAU,CAAC,GAAW;IACrC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC"}
@@ -1,9 +1,11 @@
1
1
  export { copysign } from "./copysign.ts";
2
2
  export { fabs } from "./fabs.ts";
3
+ export { fpclassify } from "./fpclassify.ts";
3
4
  export { frexp, type FrexpResult } from "./frexp.ts";
4
5
  export { hypot } from "./hypot.ts";
5
6
  export { iscanonical } from "./iscanonical.ts";
6
7
  export { ldexp } from "./ldexp.ts";
8
+ export * from "./macros.ts";
7
9
  export { nan } from "./nan.ts";
8
10
  export { nextafter } from "./nextafter.ts";
9
11
  export { pow } from "./pow.ts";
@@ -1,9 +1,11 @@
1
1
  export { copysign } from "./copysign.js";
2
2
  export { fabs } from "./fabs.js";
3
+ export { fpclassify } from "./fpclassify.js";
3
4
  export { frexp } from "./frexp.js";
4
5
  export { hypot } from "./hypot.js";
5
6
  export { iscanonical } from "./iscanonical.js";
6
7
  export { ldexp } from "./ldexp.js";
8
+ export * from "./macros.js";
7
9
  export { nan } from "./nan.js";
8
10
  export { nextafter } from "./nextafter.js";
9
11
  export { pow } from "./pow.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/namespace-std/doubles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/namespace-std/doubles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const FP_INFINITE = 0;
2
+ export declare const FP_NAN = 1;
3
+ export declare const FP_NORMAL = 2;
4
+ export declare const FP_SUBNORMAL = 3;
5
+ export declare const FP_ZERO = 4;
6
+ export type FPClassification = typeof FP_INFINITE | typeof FP_NAN | typeof FP_NORMAL | typeof FP_SUBNORMAL | typeof FP_ZERO;
@@ -0,0 +1,6 @@
1
+ export const FP_INFINITE = 0;
2
+ export const FP_NAN = 1;
3
+ export const FP_NORMAL = 2;
4
+ export const FP_SUBNORMAL = 3;
5
+ export const FP_ZERO = 4;
6
+ //# sourceMappingURL=macros.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macros.js","sourceRoot":"","sources":["../../../src/namespace-std/doubles/macros.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AACxB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/oskarlh/cmath-js.git"
7
7
  },
8
- "version": "5.1.0",
8
+ "version": "5.2.0",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",