|
21 | 21 | /* eslint-disable max-lines */ |
22 | 22 |
|
23 | 23 | import isAlmostEqual = require( '@stdlib/complex/float32/base/assert/is-almost-equal' ); |
| 24 | +import isAlmostSameValue = require( '@stdlib/complex/float32/base/assert/is-almost-same-value' ); |
24 | 25 | import isEqual = require( '@stdlib/complex/float32/base/assert/is-equal' ); |
25 | 26 | import isNotEqual = require( '@stdlib/complex/float32/base/assert/is-not-equal' ); |
26 | 27 | import isSameValue = require( '@stdlib/complex/float32/base/assert/is-same-value' ); |
@@ -58,6 +59,33 @@ interface Namespace { |
58 | 59 | */ |
59 | 60 | isAlmostEqual: typeof isAlmostEqual; |
60 | 61 |
|
| 62 | + /** |
| 63 | + * Tests whether two single-precision complex floating-point numbers are approximately the same value within a specified number of ULPs (units in the last place). |
| 64 | + * |
| 65 | + * ## Notes |
| 66 | + * |
| 67 | + * - The function differs from the `===` operator in that the function treats `-0` and `+0` as distinct and `NaNs` as the same. |
| 68 | + * |
| 69 | + * @param z1 - first complex number |
| 70 | + * @param z2 - second complex number |
| 71 | + * @param maxULP - maximum allowed ULP difference |
| 72 | + * @returns boolean indicating whether two single-precision complex floating-point numbers are approximately the same value within a specified number of ULPs |
| 73 | + * |
| 74 | + * @example |
| 75 | + * var EPS = require( '@stdlib/constants/float32/eps' ); |
| 76 | + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); |
| 77 | + * |
| 78 | + * var z1 = new Complex64( 1.0, 3.0 ); |
| 79 | + * var z2 = new Complex64( 1.0+EPS, 3.0 ); |
| 80 | + * |
| 81 | + * var bool = ns.isAlmostSameValue( z1, z2, 0 ); |
| 82 | + * // returns false |
| 83 | + * |
| 84 | + * bool = ns.isAlmostSameValue( z1, z2, 1 ); |
| 85 | + * // returns true |
| 86 | + */ |
| 87 | + isAlmostSameValue: typeof isAlmostSameValue; |
| 88 | + |
61 | 89 | /** |
62 | 90 | * Tests whether two single-precision complex floating-point numbers are equal. |
63 | 91 | * |
|
0 commit comments