Skip to content

Commit d46e973

Browse files
authored
feat: update number/float64/base/assert TypeScript declarations
PR-URL: #9203 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 4e6ab18 commit d46e973

File tree

1 file changed

+39
-0
lines changed
  • lib/node_modules/@stdlib/number/float64/base/assert/docs/types

1 file changed

+39
-0
lines changed

lib/node_modules/@stdlib/number/float64/base/assert/docs/types/index.d.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/* eslint-disable max-lines */
2222

2323
import isAlmostEqual = require( '@stdlib/number/float64/base/assert/is-almost-equal' );
24+
import isAlmostSameValue = require( '@stdlib/number/float64/base/assert/is-almost-same-value' );
2425
import isSameValue = require( '@stdlib/number/float64/base/assert/is-same-value' );
2526
import isSameValueZero = require( '@stdlib/number/float64/base/assert/is-same-value-zero' );
2627

@@ -67,6 +68,44 @@ interface Namespace {
6768
*/
6869
isAlmostEqual: typeof isAlmostEqual;
6970

71+
/**
72+
* Tests if two double-precision floating-point numbers are approximately the same value within a specified number of ULPs (units in the last place).
73+
*
74+
* ## Notes
75+
*
76+
* - The function differs from the `===` operator in that the function treats `-0` and `+0` as distinct and `NaNs` as the same.
77+
*
78+
* @param a - first input value
79+
* @param b - second input value
80+
* @param maxULP - maximum allowed ULP difference
81+
* @returns boolean indicating whether two double-precision floating-point numbers are approximately the same value within a specified number of ULPs
82+
*
83+
* @example
84+
* var EPS = require( '@stdlib/constants/float64/eps' );
85+
*
86+
* var bool = ns.isAlmostSameValue( 1.0, 1.0+EPS, 1 );
87+
* // returns true
88+
*
89+
* bool = ns.isAlmostSameValue( 1.0+EPS, 1.0, 1 );
90+
* // returns true
91+
*
92+
* bool = ns.isAlmostSameValue( 1.0, 1.0+EPS+EPS, 1 );
93+
* // returns false
94+
*
95+
* bool = ns.isAlmostSameValue( 1.0, 1.0+EPS, 0 );
96+
* // returns false
97+
*
98+
* bool = ns.isAlmostSameValue( 0.0, -0.0, 0 );
99+
* // returns false
100+
*
101+
* bool = ns.isAlmostSameValue( 1.0, NaN, 1 );
102+
* // returns false
103+
*
104+
* bool = ns.isAlmostSameValue( NaN, NaN, 1 );
105+
* // returns true
106+
*/
107+
isAlmostSameValue: typeof isAlmostSameValue;
108+
70109
/**
71110
* Tests if two double-precision floating-point numbers are the same value.
72111
*

0 commit comments

Comments
 (0)