|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2025 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# isAlmostSameValueFloat64Array |
| 22 | + |
| 23 | +> Test if two arguments are both [Float64Arrays][@stdlib/array/float64] and contain respective elements which are [approximately the same value][@stdlib/assert/is-almost-same-value] within a specified number of ULPs (units in the last place). |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +<!-- eslint-disable id-length --> |
| 30 | + |
| 31 | +```javascript |
| 32 | +var isAlmostSameValueFloat64Array = require( '@stdlib/assert/is-almost-same-value-float64array' ); |
| 33 | +``` |
| 34 | + |
| 35 | +#### isAlmostSameValueFloat64Array( v1, v2, maxULP ) |
| 36 | + |
| 37 | +Tests if two arguments are both [Float64Arrays][@stdlib/array/float64] and contain respective elements which are [approximately the same value][@stdlib/assert/is-almost-same-value] within a specified number of ULPs (units in the last place). |
| 38 | + |
| 39 | +<!-- eslint-disable id-length --> |
| 40 | + |
| 41 | +```javascript |
| 42 | +var EPS = require( '@stdlib/constants/float64/eps' ); |
| 43 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 44 | + |
| 45 | +var x = new Float64Array( [ 1.0, 2.0 ] ); |
| 46 | +var y = new Float64Array( [ 1.0+EPS, 2.0 ] ); |
| 47 | + |
| 48 | +var bool = isAlmostSameValueFloat64Array( x, y, 0 ); |
| 49 | +// returns false |
| 50 | + |
| 51 | +bool = isAlmostSameValueFloat64Array( x, y, 1 ); |
| 52 | +// returns true |
| 53 | + |
| 54 | +bool = isAlmostSameValueFloat64Array( x, [ 1.0, 2.0 ], 1 ); |
| 55 | +// returns false |
| 56 | +``` |
| 57 | + |
| 58 | +</section> |
| 59 | + |
| 60 | +<!-- /.usage --> |
| 61 | + |
| 62 | +<section class="notes"> |
| 63 | + |
| 64 | +</section> |
| 65 | + |
| 66 | +<!-- /.notes --> |
| 67 | + |
| 68 | +<section class="examples"> |
| 69 | + |
| 70 | +## Examples |
| 71 | + |
| 72 | +<!-- eslint-disable id-length --> |
| 73 | + |
| 74 | +<!-- eslint no-undef: "error" --> |
| 75 | + |
| 76 | +```javascript |
| 77 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 78 | +var isAlmostSameValueFloat64Array = require( '@stdlib/assert/is-almost-same-value-float64array' ); |
| 79 | + |
| 80 | +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); |
| 81 | +var y = new Float64Array( [ 1.0, 2.0, 3.0 ] ); |
| 82 | +var out = isAlmostSameValueFloat64Array( x, y, 0 ); |
| 83 | +// returns true |
| 84 | + |
| 85 | +x = new Float64Array( [ -0.0, 0.0, -0.0 ] ); |
| 86 | +y = new Float64Array( [ 0.0, -0.0, 0.0 ] ); |
| 87 | +out = isAlmostSameValueFloat64Array( x, y, 0 ); |
| 88 | +// returns false |
| 89 | + |
| 90 | +x = new Float64Array( [ NaN, NaN, NaN ] ); |
| 91 | +y = new Float64Array( [ NaN, NaN, NaN ] ); |
| 92 | +out = isAlmostSameValueFloat64Array( x, y, 0 ); |
| 93 | +// returns true |
| 94 | +``` |
| 95 | + |
| 96 | +</section> |
| 97 | + |
| 98 | +<!-- /.examples --> |
| 99 | + |
| 100 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 101 | + |
| 102 | +<section class="related"> |
| 103 | + |
| 104 | +</section> |
| 105 | + |
| 106 | +<!-- /.related --> |
| 107 | + |
| 108 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 109 | + |
| 110 | +<section class="links"> |
| 111 | + |
| 112 | +[@stdlib/array/float64]: https://github.com/stdlib-js/array-float64 |
| 113 | + |
| 114 | +[@stdlib/assert/is-almost-same-value]: https://github.com/stdlib-js/assert/tree/main/is-almost-same-value |
| 115 | + |
| 116 | +</section> |
| 117 | + |
| 118 | +<!-- /.links --> |
0 commit comments