@nberlette/math 0.7.1 → 0.7.3
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/cjs/constants/e.d.ts +14 -0
- package/cjs/constants/e.d.ts.map +1 -1
- package/cjs/constants/epsilon.d.ts +14 -0
- package/cjs/constants/epsilon.d.ts.map +1 -1
- package/cjs/constants/ln2.d.ts +14 -0
- package/cjs/constants/ln2.d.ts.map +1 -1
- package/cjs/constants/log10e.d.ts +14 -0
- package/cjs/constants/log10e.d.ts.map +1 -1
- package/cjs/constants/log2e.d.ts +14 -0
- package/cjs/constants/log2e.d.ts.map +1 -1
- package/cjs/constants/max_safe_integer.d.ts +14 -0
- package/cjs/constants/max_safe_integer.d.ts.map +1 -1
- package/cjs/constants/max_value.d.ts +14 -0
- package/cjs/constants/max_value.d.ts.map +1 -1
- package/cjs/constants/min_safe_integer.d.ts +14 -0
- package/cjs/constants/min_safe_integer.d.ts.map +1 -1
- package/cjs/constants/min_value.d.ts +14 -0
- package/cjs/constants/min_value.d.ts.map +1 -1
- package/cjs/constants/pi.d.ts +14 -0
- package/cjs/constants/pi.d.ts.map +1 -1
- package/cjs/constants/sqrt1_2.d.ts +14 -0
- package/cjs/constants/sqrt1_2.d.ts.map +1 -1
- package/cjs/constants/sqrt2.d.ts +14 -0
- package/cjs/constants/sqrt2.d.ts.map +1 -1
- package/cjs/float16/guards.d.ts +1 -0
- package/cjs/float16/guards.d.ts.map +1 -1
- package/cjs/float16/guards.js +1 -0
- package/cjs/float16/guards.js.map +1 -1
- package/cjs/float32/guards.d.ts +2 -0
- package/cjs/float32/guards.d.ts.map +1 -1
- package/cjs/float32/guards.js +2 -0
- package/cjs/float32/guards.js.map +1 -1
- package/cjs/guards/integer.js +3 -3
- package/cjs/guards/integer.js.map +1 -1
- package/cjs/types/finite.d.ts +1 -1
- package/cjs/types/finite.js +1 -1
- package/cjs/types/float.d.ts +1 -1
- package/cjs/types/integer.d.ts +1 -1
- package/cjs/types/precision.d.ts +1 -1
- package/cjs/types/precision.js +1 -1
- package/cjs/types/safe_integer.d.ts +1 -1
- package/cjs/types/safe_integer.js +1 -1
- package/esm/constants/e.d.ts +14 -0
- package/esm/constants/e.d.ts.map +1 -1
- package/esm/constants/epsilon.d.ts +14 -0
- package/esm/constants/epsilon.d.ts.map +1 -1
- package/esm/constants/ln2.d.ts +14 -0
- package/esm/constants/ln2.d.ts.map +1 -1
- package/esm/constants/log10e.d.ts +14 -0
- package/esm/constants/log10e.d.ts.map +1 -1
- package/esm/constants/log2e.d.ts +14 -0
- package/esm/constants/log2e.d.ts.map +1 -1
- package/esm/constants/max_safe_integer.d.ts +14 -0
- package/esm/constants/max_safe_integer.d.ts.map +1 -1
- package/esm/constants/max_value.d.ts +14 -0
- package/esm/constants/max_value.d.ts.map +1 -1
- package/esm/constants/min_safe_integer.d.ts +14 -0
- package/esm/constants/min_safe_integer.d.ts.map +1 -1
- package/esm/constants/min_value.d.ts +14 -0
- package/esm/constants/min_value.d.ts.map +1 -1
- package/esm/constants/pi.d.ts +14 -0
- package/esm/constants/pi.d.ts.map +1 -1
- package/esm/constants/sqrt1_2.d.ts +14 -0
- package/esm/constants/sqrt1_2.d.ts.map +1 -1
- package/esm/constants/sqrt2.d.ts +14 -0
- package/esm/constants/sqrt2.d.ts.map +1 -1
- package/esm/float16/guards.d.ts +1 -0
- package/esm/float16/guards.d.ts.map +1 -1
- package/esm/float16/guards.js +1 -0
- package/esm/float16/guards.js.map +1 -1
- package/esm/float32/guards.d.ts +2 -0
- package/esm/float32/guards.d.ts.map +1 -1
- package/esm/float32/guards.js +2 -0
- package/esm/float32/guards.js.map +1 -1
- package/esm/guards/integer.js +3 -3
- package/esm/guards/integer.js.map +1 -1
- package/esm/types/finite.d.ts +1 -1
- package/esm/types/finite.js +1 -1
- package/esm/types/float.d.ts +1 -1
- package/esm/types/integer.d.ts +1 -1
- package/esm/types/precision.d.ts +1 -1
- package/esm/types/precision.js +1 -1
- package/esm/types/safe_integer.d.ts +1 -1
- package/esm/types/safe_integer.js +1 -1
- package/package.json +1 -1
- package/src/constants/e.ts +14 -0
- package/src/constants/epsilon.ts +14 -0
- package/src/constants/ln2.ts +14 -0
- package/src/constants/log10e.ts +14 -0
- package/src/constants/log2e.ts +14 -0
- package/src/constants/max_safe_integer.ts +14 -0
- package/src/constants/max_value.ts +14 -0
- package/src/constants/min_safe_integer.ts +14 -0
- package/src/constants/min_value.ts +14 -0
- package/src/constants/pi.ts +14 -0
- package/src/constants/sqrt1_2.ts +14 -0
- package/src/constants/sqrt2.ts +14 -0
- package/src/float16/guards.ts +2 -0
- package/src/float32/guards.ts +4 -0
- package/src/guards/integer.ts +4 -4
- package/src/types/finite.ts +1 -1
- package/src/types/float.ts +1 -1
- package/src/types/integer.ts +1 -1
- package/src/types/precision.ts +1 -1
- package/src/types/safe_integer.ts +1 -1
- package/nberlette-math-0.7.0.tgz +0 -0
|
@@ -21,5 +21,19 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export declare const MAX_SAFE_INTEGER: MAX_SAFE_INTEGER;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `MAX_SAFE_INTEGER` constant exported by this module. This allows
|
|
26
|
+
* `MAX_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { MAX_SAFE_INTEGER } from "@nick/math/constants/max-safe-integer";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<MAX_SAFE_INTEGER>(9007199254740991);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type MAX_SAFE_INTEGER = 9007199254740991;
|
|
25
39
|
//# sourceMappingURL=max_safe_integer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max_safe_integer.d.ts","sourceRoot":"","sources":["../../src/constants/max_safe_integer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAmC,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"max_safe_integer.d.ts","sourceRoot":"","sources":["../../src/constants/max_safe_integer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAmC,CAAC;AACnE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC"}
|
|
@@ -20,5 +20,19 @@
|
|
|
20
20
|
* @category Constants
|
|
21
21
|
*/
|
|
22
22
|
export declare const MAX_VALUE: MAX_VALUE;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level alias of the `MAX_VALUE` constant exported by this module. This allows
|
|
25
|
+
* `MAX_VALUE` to be imported using a standard named import (i.e. the _value_ level)
|
|
26
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { MAX_VALUE } from "@nick/math/constants/max-value";
|
|
31
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
32
|
+
*
|
|
33
|
+
* expectType<MAX_VALUE>(1.7976931348623157e308);
|
|
34
|
+
* ```
|
|
35
|
+
* @category Constants
|
|
36
|
+
*/
|
|
23
37
|
export type MAX_VALUE = 1.7976931348623157e308;
|
|
24
38
|
//# sourceMappingURL=max_value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max_value.d.ts","sourceRoot":"","sources":["../../src/constants/max_value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,SAAkC,CAAC;AAC3D,MAAM,MAAM,SAAS,GAAG,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"max_value.d.ts","sourceRoot":"","sources":["../../src/constants/max_value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,SAAkC,CAAC;AAC3D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,sBAAsB,CAAC"}
|
|
@@ -22,5 +22,19 @@
|
|
|
22
22
|
* @category Constants
|
|
23
23
|
*/
|
|
24
24
|
export declare const MIN_SAFE_INTEGER: MIN_SAFE_INTEGER;
|
|
25
|
+
/**
|
|
26
|
+
* Type-level alias of the `MIN_SAFE_INTEGER` constant exported by this module. This allows
|
|
27
|
+
* `MIN_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level)
|
|
28
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import type { MIN_SAFE_INTEGER } from "@nick/math/constants/min-safe-integer";
|
|
33
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
34
|
+
*
|
|
35
|
+
* expectType<MIN_SAFE_INTEGER>(-9007199254740991);
|
|
36
|
+
* ```
|
|
37
|
+
* @category Constants
|
|
38
|
+
*/
|
|
25
39
|
export type MIN_SAFE_INTEGER = -9007199254740991;
|
|
26
40
|
//# sourceMappingURL=min_safe_integer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min_safe_integer.d.ts","sourceRoot":"","sources":["../../src/constants/min_safe_integer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAoC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"min_safe_integer.d.ts","sourceRoot":"","sources":["../../src/constants/min_safe_integer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAoC,CAAC;AACpE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,CAAC"}
|
|
@@ -20,5 +20,19 @@
|
|
|
20
20
|
* @category Constants
|
|
21
21
|
*/
|
|
22
22
|
export declare const MIN_VALUE: MIN_VALUE;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level alias of the `MIN_VALUE` constant exported by this module. This allows
|
|
25
|
+
* `MIN_VALUE` to be imported using a standard named import (i.e. the _value_ level)
|
|
26
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { MIN_VALUE } from "@nick/math/constants/min-value";
|
|
31
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
32
|
+
*
|
|
33
|
+
* expectType<MIN_VALUE>(5e-324);
|
|
34
|
+
* ```
|
|
35
|
+
* @category Constants
|
|
36
|
+
*/
|
|
23
37
|
export type MIN_VALUE = 5e-324;
|
|
24
38
|
//# sourceMappingURL=min_value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min_value.d.ts","sourceRoot":"","sources":["../../src/constants/min_value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,SAAkB,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"min_value.d.ts","sourceRoot":"","sources":["../../src/constants/min_value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,SAAkB,CAAC;AAC3C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
|
package/esm/constants/pi.d.ts
CHANGED
|
@@ -20,5 +20,19 @@
|
|
|
20
20
|
* @category Constants
|
|
21
21
|
*/
|
|
22
22
|
export declare const PI: PI;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level alias of the `PI` constant exported by this module. This allows
|
|
25
|
+
* `PI` to be imported using a standard named import (i.e. the _value_ level)
|
|
26
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { PI } from "@nick/math/constants/pi";
|
|
31
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
32
|
+
*
|
|
33
|
+
* expectType<PI>(3.141592653589793);
|
|
34
|
+
* ```
|
|
35
|
+
* @category Constants
|
|
36
|
+
*/
|
|
23
37
|
export type PI = 3.141592653589793;
|
|
24
38
|
//# sourceMappingURL=pi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/constants/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,EAAsB,CAAC;AACxC,MAAM,MAAM,EAAE,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/constants/pi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,EAAsB,CAAC;AACxC;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,EAAE,GAAG,iBAAiB,CAAC"}
|
|
@@ -19,5 +19,19 @@
|
|
|
19
19
|
* @category Constants
|
|
20
20
|
*/
|
|
21
21
|
export declare const SQRT1_2: SQRT1_2;
|
|
22
|
+
/**
|
|
23
|
+
* Type-level alias of the `SQRT1_2` constant exported by this module. This allows
|
|
24
|
+
* `SQRT1_2` to be imported using a standard named import (i.e. the _value_ level)
|
|
25
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import type { SQRT1_2 } from "@nick/math/constants/sqrt1_2";
|
|
30
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
31
|
+
*
|
|
32
|
+
* expectType<SQRT1_2>(0.7071067811865476);
|
|
33
|
+
* ```
|
|
34
|
+
* @category Constants
|
|
35
|
+
*/
|
|
22
36
|
export type SQRT1_2 = 0.7071067811865476;
|
|
23
37
|
//# sourceMappingURL=sqrt1_2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqrt1_2.d.ts","sourceRoot":"","sources":["../../src/constants/sqrt1_2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,OAA4B,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sqrt1_2.d.ts","sourceRoot":"","sources":["../../src/constants/sqrt1_2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,OAA4B,CAAC;AACnD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,kBAAkB,CAAC"}
|
package/esm/constants/sqrt2.d.ts
CHANGED
|
@@ -19,5 +19,19 @@
|
|
|
19
19
|
* @category Constants
|
|
20
20
|
*/
|
|
21
21
|
export declare const SQRT2: SQRT2;
|
|
22
|
+
/**
|
|
23
|
+
* Type-level alias of the `SQRT2` constant exported by this module. This allows
|
|
24
|
+
* `SQRT2` to be imported using a standard named import (i.e. the _value_ level)
|
|
25
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import type { SQRT2 } from "@nick/math/constants/sqrt2";
|
|
30
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
31
|
+
*
|
|
32
|
+
* expectType<SQRT2>(1.4142135623730951);
|
|
33
|
+
* ```
|
|
34
|
+
* @category Constants
|
|
35
|
+
*/
|
|
22
36
|
export type SQRT2 = 1.4142135623730951;
|
|
23
37
|
//# sourceMappingURL=sqrt2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqrt2.d.ts","sourceRoot":"","sources":["../../src/constants/sqrt2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAA0B,CAAC;AAC/C,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sqrt2.d.ts","sourceRoot":"","sources":["../../src/constants/sqrt2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAA0B,CAAC;AAC/C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC"}
|
package/esm/float16/guards.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ import type { Float16 } from "../types/float.js";
|
|
|
18
18
|
* @tags float16
|
|
19
19
|
*/
|
|
20
20
|
export declare function isFloat16<N extends number>(it: N): it is Float16<N>;
|
|
21
|
+
/** @inheritDoc */
|
|
21
22
|
export declare function isFloat16(it: unknown): it is Float16<number>;
|
|
22
23
|
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/float16/guards.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/float16/guards.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,kBAAkB;AAClB,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC"}
|
package/esm/float16/guards.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/float16/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/float16/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAuB1C,kBAAkB;AAClB,MAAM,UAAU,SAAS,CAAC,EAAW;IACnC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
package/esm/float32/guards.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { Float32 } from "../types/float.js";
|
|
|
19
19
|
* @tags float32
|
|
20
20
|
*/
|
|
21
21
|
export declare function isFloat32<N extends number>(it: N): it is Float32<N>;
|
|
22
|
+
/** @inheritDoc */
|
|
22
23
|
export declare function isFloat32(it: unknown): it is Float32<number>;
|
|
23
24
|
/**
|
|
24
25
|
* Checks if the given value is a finite float32 number, as per the IEEE
|
|
@@ -33,5 +34,6 @@ export declare function isFloat32(it: unknown): it is Float32<number>;
|
|
|
33
34
|
* @tags float32
|
|
34
35
|
*/
|
|
35
36
|
export declare function isFiniteFloat32<N extends number>(it: N): it is Finite<N> & Float32<N>;
|
|
37
|
+
/** @inheritDoc */
|
|
36
38
|
export declare function isFiniteFloat32(it: unknown): it is Float32<number>;
|
|
37
39
|
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/float32/guards.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/float32/guards.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,kBAAkB;AAClB,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;AAM9D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,EAAE,EAAE,CAAC,GACJ,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAChC,kBAAkB;AAClB,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC"}
|
package/esm/float32/guards.js
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
import { isNaN } from "../guards/nan.js";
|
|
17
17
|
import { isFinite } from "../guards/finite.js";
|
|
18
18
|
import { roundFloat32 } from "./round.js";
|
|
19
|
+
/** @inheritDoc */
|
|
19
20
|
export function isFloat32(it) {
|
|
20
21
|
return typeof it === "number" && !isNaN(it) && it === roundFloat32(it);
|
|
21
22
|
}
|
|
23
|
+
/** @inheritDoc */
|
|
22
24
|
export function isFiniteFloat32(it) {
|
|
23
25
|
return isFloat32(it) && isFinite(it);
|
|
24
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/float32/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAe,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/float32/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAe,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAuB1C,kBAAkB;AAClB,MAAM,UAAU,SAAS,CAAC,EAAW;IACnC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAmBD,kBAAkB;AAClB,MAAM,UAAU,eAAe,CAAC,EAAW;IACzC,OAAO,SAAS,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
package/esm/guards/integer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** @
|
|
2
|
-
// deno-lint-ignore no-explicit-any
|
|
1
|
+
/** @inheritDoc */
|
|
3
2
|
export function isInteger(number) {
|
|
4
|
-
|
|
3
|
+
const value = +number;
|
|
4
|
+
return value % 1 === 0;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Checks if a given number is a whole number (integer), in a way that is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer.js","sourceRoot":"","sources":["../../src/guards/integer.ts"],"names":[],"mappings":"AA+CA,
|
|
1
|
+
{"version":3,"file":"integer.js","sourceRoot":"","sources":["../../src/guards/integer.ts"],"names":[],"mappings":"AA+CA,kBAAkB;AAClB,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,MAAM,KAAK,GAAG,CAAE,MAAiB,CAAC;IAClC,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAS;IAET,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
package/esm/types/finite.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { Finite } from "@nick/math/types/finite";
|
|
8
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
8
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
9
9
|
*
|
|
10
10
|
* const value = 42 as Finite;
|
|
11
11
|
* expectType<Finite>(value);
|
package/esm/types/finite.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { Finite } from "@nick/math/types/finite";
|
|
8
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
8
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
9
9
|
*
|
|
10
10
|
* const value = 42 as Finite;
|
|
11
11
|
* expectType<Finite>(value);
|
package/esm/types/float.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
12
12
|
* import type { Float32 } from "@nick/math/types/float";
|
|
13
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
13
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
14
14
|
*
|
|
15
15
|
* const value = 1 as Float32;
|
|
16
16
|
* expectType<Float32>(value);
|
package/esm/types/integer.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { Int32 } from "@nick/math/types/integer";
|
|
8
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
8
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
9
9
|
*
|
|
10
10
|
* const value = 42 as Int32;
|
|
11
11
|
* expectType<Int32>(value);
|
package/esm/types/precision.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { P32, Precision } from "@nick/math/types/precision";
|
|
8
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
8
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
9
9
|
*
|
|
10
10
|
* expectType<P32>(32);
|
|
11
11
|
* expectType<Precision>(32);
|
package/esm/types/precision.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
7
7
|
* import type { P32, Precision } from "@nick/math/types/precision";
|
|
8
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
8
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
9
9
|
*
|
|
10
10
|
* expectType<P32>(32);
|
|
11
11
|
* expectType<Precision>(32);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```ts
|
|
7
7
|
* import { isSafeInteger } from "@nick/math/is/safe-integer";
|
|
8
8
|
* import type { SafeInteger } from "@nick/math/types/safe-integer";
|
|
9
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
9
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
10
10
|
*
|
|
11
11
|
* let user_input: number = 42;
|
|
12
12
|
* if (isSafeInteger(user_input)) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```ts
|
|
7
7
|
* import { isSafeInteger } from "@nick/math/is/safe-integer";
|
|
8
8
|
* import type { SafeInteger } from "@nick/math/types/safe-integer";
|
|
9
|
-
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"
|
|
9
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
10
10
|
*
|
|
11
11
|
* let user_input: number = 42;
|
|
12
12
|
* if (isSafeInteger(user_input)) {
|
package/package.json
CHANGED
package/src/constants/e.ts
CHANGED
|
@@ -22,4 +22,18 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export const E: E = 2.718281828459045;
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Type-level alias of the `E` constant exported by this module. This allows
|
|
27
|
+
* `E` to be imported using a standard named import (i.e. the _value_ level)
|
|
28
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import type { E } from "@nick/math/constants/e";
|
|
33
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
34
|
+
*
|
|
35
|
+
* expectType<E>(2.718281828459045);
|
|
36
|
+
* ```
|
|
37
|
+
* @category Constants
|
|
38
|
+
*/
|
|
25
39
|
export type E = 2.718281828459045;
|
package/src/constants/epsilon.ts
CHANGED
|
@@ -29,4 +29,18 @@
|
|
|
29
29
|
*/
|
|
30
30
|
export const EPSILON: EPSILON = 2.220446049250313e-16;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Type-level alias of the `EPSILON` constant exported by this module. This allows
|
|
34
|
+
* `EPSILON` to be imported using a standard named import (i.e. the _value_ level)
|
|
35
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import type { EPSILON } from "@nick/math/constants/epsilon";
|
|
40
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
41
|
+
*
|
|
42
|
+
* expectType<EPSILON>(2.220446049250313e-16);
|
|
43
|
+
* ```
|
|
44
|
+
* @category Constants
|
|
45
|
+
*/
|
|
32
46
|
export type EPSILON = 2.220446049250313e-16;
|
package/src/constants/ln2.ts
CHANGED
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const LN2: LN2 = 0.6931471805599453;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `LN2` constant exported by this module. This allows
|
|
26
|
+
* `LN2` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { LN2 } from "@nick/math/constants/ln2";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<LN2>(0.6931471805599453);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type LN2 = 0.6931471805599453;
|
package/src/constants/log10e.ts
CHANGED
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const LOG10E: LOG10E = 0.4342944819032518;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `LOG10E` constant exported by this module. This allows
|
|
26
|
+
* `LOG10E` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { LOG10E } from "@nick/math/constants/log10e";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<LOG10E>(0.4342944819032518);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type LOG10E = 0.4342944819032518;
|
package/src/constants/log2e.ts
CHANGED
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const LOG2E: LOG2E = 1.4426950408889634;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `LOG2E` constant exported by this module. This allows
|
|
26
|
+
* `LOG2E` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { LOG2E } from "@nick/math/constants/log2e";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<LOG2E>(1.4426950408889634);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type LOG2E = 1.4426950408889634;
|
|
@@ -22,4 +22,18 @@
|
|
|
22
22
|
* @category Constants
|
|
23
23
|
*/
|
|
24
24
|
export const MAX_SAFE_INTEGER: MAX_SAFE_INTEGER = 9007199254740991;
|
|
25
|
+
/**
|
|
26
|
+
* Type-level alias of the `MAX_SAFE_INTEGER` constant exported by this module. This allows
|
|
27
|
+
* `MAX_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level)
|
|
28
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import type { MAX_SAFE_INTEGER } from "@nick/math/constants/max-safe-integer";
|
|
33
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
34
|
+
*
|
|
35
|
+
* expectType<MAX_SAFE_INTEGER>(9007199254740991);
|
|
36
|
+
* ```
|
|
37
|
+
* @category Constants
|
|
38
|
+
*/
|
|
25
39
|
export type MAX_SAFE_INTEGER = 9007199254740991;
|
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const MAX_VALUE: MAX_VALUE = 1.7976931348623157e308;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `MAX_VALUE` constant exported by this module. This allows
|
|
26
|
+
* `MAX_VALUE` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { MAX_VALUE } from "@nick/math/constants/max-value";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<MAX_VALUE>(1.7976931348623157e308);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type MAX_VALUE = 1.7976931348623157e308;
|
|
@@ -23,4 +23,18 @@
|
|
|
23
23
|
* @category Constants
|
|
24
24
|
*/
|
|
25
25
|
export const MIN_SAFE_INTEGER: MIN_SAFE_INTEGER = -9007199254740991;
|
|
26
|
+
/**
|
|
27
|
+
* Type-level alias of the `MIN_SAFE_INTEGER` constant exported by this module. This allows
|
|
28
|
+
* `MIN_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level)
|
|
29
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import type { MIN_SAFE_INTEGER } from "@nick/math/constants/min-safe-integer";
|
|
34
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
35
|
+
*
|
|
36
|
+
* expectType<MIN_SAFE_INTEGER>(-9007199254740991);
|
|
37
|
+
* ```
|
|
38
|
+
* @category Constants
|
|
39
|
+
*/
|
|
26
40
|
export type MIN_SAFE_INTEGER = -9007199254740991;
|
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const MIN_VALUE: MIN_VALUE = 5e-324;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `MIN_VALUE` constant exported by this module. This allows
|
|
26
|
+
* `MIN_VALUE` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { MIN_VALUE } from "@nick/math/constants/min-value";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<MIN_VALUE>(5e-324);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type MIN_VALUE = 5e-324;
|
package/src/constants/pi.ts
CHANGED
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* @category Constants
|
|
22
22
|
*/
|
|
23
23
|
export const PI: PI = 3.141592653589793;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level alias of the `PI` constant exported by this module. This allows
|
|
26
|
+
* `PI` to be imported using a standard named import (i.e. the _value_ level)
|
|
27
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import type { PI } from "@nick/math/constants/pi";
|
|
32
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
33
|
+
*
|
|
34
|
+
* expectType<PI>(3.141592653589793);
|
|
35
|
+
* ```
|
|
36
|
+
* @category Constants
|
|
37
|
+
*/
|
|
24
38
|
export type PI = 3.141592653589793;
|
package/src/constants/sqrt1_2.ts
CHANGED
|
@@ -20,4 +20,18 @@
|
|
|
20
20
|
* @category Constants
|
|
21
21
|
*/
|
|
22
22
|
export const SQRT1_2: SQRT1_2 = 0.7071067811865476;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level alias of the `SQRT1_2` constant exported by this module. This allows
|
|
25
|
+
* `SQRT1_2` to be imported using a standard named import (i.e. the _value_ level)
|
|
26
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { SQRT1_2 } from "@nick/math/constants/sqrt1_2";
|
|
31
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
32
|
+
*
|
|
33
|
+
* expectType<SQRT1_2>(0.7071067811865476);
|
|
34
|
+
* ```
|
|
35
|
+
* @category Constants
|
|
36
|
+
*/
|
|
23
37
|
export type SQRT1_2 = 0.7071067811865476;
|
package/src/constants/sqrt2.ts
CHANGED
|
@@ -20,4 +20,18 @@
|
|
|
20
20
|
* @category Constants
|
|
21
21
|
*/
|
|
22
22
|
export const SQRT2: SQRT2 = 1.4142135623730951;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level alias of the `SQRT2` constant exported by this module. This allows
|
|
25
|
+
* `SQRT2` to be imported using a standard named import (i.e. the _value_ level)
|
|
26
|
+
* or via type-only import for a compile-time only reference to the same value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { SQRT2 } from "@nick/math/constants/sqrt2";
|
|
31
|
+
* import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";
|
|
32
|
+
*
|
|
33
|
+
* expectType<SQRT2>(1.4142135623730951);
|
|
34
|
+
* ```
|
|
35
|
+
* @category Constants
|
|
36
|
+
*/
|
|
23
37
|
export type SQRT2 = 1.4142135623730951;
|
package/src/float16/guards.ts
CHANGED
|
@@ -35,7 +35,9 @@ import { roundFloat16 } from "./round.js";
|
|
|
35
35
|
* @tags float16
|
|
36
36
|
*/
|
|
37
37
|
export function isFloat16<N extends number>(it: N): it is Float16<N>;
|
|
38
|
+
/** @inheritDoc */
|
|
38
39
|
export function isFloat16(it: unknown): it is Float16<number>;
|
|
40
|
+
/** @inheritDoc */
|
|
39
41
|
export function isFloat16(it: unknown): it is Float16 {
|
|
40
42
|
return typeof it === "number" && !isNaN(it) && it === roundFloat16(it);
|
|
41
43
|
}
|
package/src/float32/guards.ts
CHANGED
|
@@ -37,7 +37,9 @@ import { roundFloat32 } from "./round.js";
|
|
|
37
37
|
* @tags float32
|
|
38
38
|
*/
|
|
39
39
|
export function isFloat32<N extends number>(it: N): it is Float32<N>;
|
|
40
|
+
/** @inheritDoc */
|
|
40
41
|
export function isFloat32(it: unknown): it is Float32<number>;
|
|
42
|
+
/** @inheritDoc */
|
|
41
43
|
export function isFloat32(it: unknown): it is Float32 {
|
|
42
44
|
return typeof it === "number" && !isNaN(it) && it === roundFloat32(it);
|
|
43
45
|
}
|
|
@@ -57,7 +59,9 @@ export function isFloat32(it: unknown): it is Float32 {
|
|
|
57
59
|
export function isFiniteFloat32<N extends number>(
|
|
58
60
|
it: N,
|
|
59
61
|
): it is Finite<N> & Float32<N>;
|
|
62
|
+
/** @inheritDoc */
|
|
60
63
|
export function isFiniteFloat32(it: unknown): it is Float32<number>;
|
|
64
|
+
/** @inheritDoc */
|
|
61
65
|
export function isFiniteFloat32(it: unknown): it is Float32 {
|
|
62
66
|
return isFloat32(it) && isFinite(it);
|
|
63
67
|
}
|