diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md new file mode 100644 index 000000000000..a32875fbc032 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/README.md @@ -0,0 +1,184 @@ + + +# dlaisnan + +> LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. + +
+ +## Usage + +```javascript +var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); +``` + +#### dlaisnan( DIN1, DIN2 ) + +Tests input for NaN by comparing two double-precision floating-point arguments for inequality. + +```javascript +var bool = dlaisnan( NaN, NaN ); +// returns true + +bool = dlaisnan( NaN, 5.0 ); +// returns true + +bool = dlaisnan( 5.0, 5.0 ); +// returns false +``` + +The function has the following parameters: + +- **DIN1**: first input number. +- **DIN2**: second input number. + +
+ + + +
+ +## Notes + +- `dlaisnan()` corresponds to the [LAPACK][lapack] auxiliary routine [`dlaisnan`][lapack-dlaisnan]. +- This routine is not for general use. It exists solely to avoid over-optimization in [`disnan`][lapack-disnan]. +- `dlaisnan` checks for NaNs by comparing its two arguments for inequality. `NaN` is the only floating-point value where `NaN !== NaN` returns `true`. To check for NaNs, pass the same variable as both arguments (i.e., `dlaisnan( x, x )`). +- The function returns `true` whenever the two arguments are unequal, not only when one is `NaN`. This matches the Fortran reference implementation which simply returns `DIN1.NE.DIN2`. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); + +var opts = { + 'dtype': 'float64' +}; +var x = discreteUniform( 100, -50, 50, opts ); +var y = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js new file mode 100644 index 000000000000..5e2eb4b29344 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/benchmark/benchmark.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var dlaisnan = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var len; + var x; + var y; + var z; + var i; + + len = 100; + x = uniform( len, -50, 50 ); + y = uniform( len, -50, 50 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dlaisnan( x[ i % len ], y[ i % len ] ); + if ( typeof z !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( z ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt new file mode 100644 index 000000000000..5553849e3739 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( DIN1, DIN2 ) + Tests input for NaN by comparing two double-precision floating-point + arguments for inequality. + + Parameters + ---------- + DIN1: number + First input number. + + DIN2: number + Second input number. + + Returns + ------- + bool: boolean + Boolean indicating whether the arguments are unequal. + + Examples + -------- + > var bool = {{alias}}( NaN, NaN ) + true + > bool = {{alias}}( NaN, 5.0 ) + true + > bool = {{alias}}( 5.0, 5.0 ) + false + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts new file mode 100644 index 000000000000..a42bafe5bfe6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/index.d.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. +* +* @param DIN1 - first input number +* @param DIN2 - second input number +* @returns boolean indicating whether the arguments are unequal +* +* @example +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* @example +* var bool = dlaisnan( NaN, 5.0 ); +* // returns true +* +* @example +* var bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ +declare function dlaisnan( DIN1: number, DIN2: number ): boolean; + + +// EXPORTS // + +export = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts new file mode 100644 index 000000000000..8115794c5bfa --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/docs/types/test.ts @@ -0,0 +1,56 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dlaisnan = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + dlaisnan( 8, 2 ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided values other than two numbers... +{ + dlaisnan( true, 3 ); // $ExpectError + dlaisnan( false, 2 ); // $ExpectError + dlaisnan( '5', 1 ); // $ExpectError + dlaisnan( [], 1 ); // $ExpectError + dlaisnan( {}, 2 ); // $ExpectError + dlaisnan( ( x: number ): number => x, 2 ); // $ExpectError + + dlaisnan( 9, true ); // $ExpectError + dlaisnan( 9, false ); // $ExpectError + dlaisnan( 5, '5' ); // $ExpectError + dlaisnan( 8, [] ); // $ExpectError + dlaisnan( 9, {} ); // $ExpectError + dlaisnan( 8, ( x: number ): number => x ); // $ExpectError + + dlaisnan( [], true ); // $ExpectError + dlaisnan( {}, false ); // $ExpectError + dlaisnan( false, '5' ); // $ExpectError + dlaisnan( {}, [] ); // $ExpectError + dlaisnan( '5', ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + dlaisnan(); // $ExpectError + dlaisnan( 3 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js new file mode 100644 index 000000000000..92e8b0037ed0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/examples/index.js @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); +var dlaisnan = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; +var x = discreteUniform( 100, -50, 50, opts ); +var y = discreteUniform( 100, -50, 50, opts ); + +logEachMap( 'dlaisnan( %d, %d ) = %s', x, y, dlaisnan ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js new file mode 100644 index 000000000000..ba21fca5cdb5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/index.js @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality. +* +* @module @stdlib/lapack/base/dlaisnan +* +* @example +* var dlaisnan = require( '@stdlib/lapack/base/dlaisnan' ); +* +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* bool = dlaisnan( NaN, 5.0 ); +* // returns true +* +* bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js new file mode 100644 index 000000000000..6ecbad7ad343 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/lib/main.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Tests input for NaN by comparing two double-precision floating-point arguments for inequality. +* +* ## Notes +* +* - This routine exists solely to avoid over-optimization in `disnan`. +* +* @param {number} DIN1 - first input number +* @param {number} DIN2 - second input number +* @returns {boolean} boolean indicating whether the arguments are unequal +* +* @example +* var bool = dlaisnan( NaN, NaN ); +* // returns true +* +* @example +* var bool = dlaisnan( NaN, 5.0 ); +* // returns true +* +* @example +* var bool = dlaisnan( 5.0, 5.0 ); +* // returns false +*/ +function dlaisnan( DIN1, DIN2 ) { + return ( DIN1 !== DIN2 ); +} + + +// EXPORTS // + +module.exports = dlaisnan; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json new file mode 100644 index 000000000000..bec346c5109f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/lapack/base/dlaisnan", + "version": "0.0.0", + "description": "LAPACK auxiliary routine to test input for NaN by comparing two double-precision floating-point arguments for inequality.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dlaisnan", + "nan", + "isnan", + "test", + "inequality", + "linear", + "algebra", + "subroutines", + "float64", + "double" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js new file mode 100644 index 000000000000..d63c400ae447 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaisnan/test/test.js @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var dlaisnan = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlaisnan, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 2', function test( t ) { + t.strictEqual( dlaisnan.length, 2, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `true` when either argument is NaN', function test( t ) { + var bool; + + bool = dlaisnan( NaN, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, 5.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 5.0, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, 0.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 0.0, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NaN, PINF ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( NINF, NaN ); + t.strictEqual( bool, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `false` when both arguments are equal non-NaN values', function test( t ) { + var bool; + + bool = dlaisnan( 5.0, 5.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( 0.0, 0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -0.0, -0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -0.0, 0.0 ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( PINF, PINF ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( NINF, NINF ); + t.strictEqual( bool, false, 'returns expected value' ); + + bool = dlaisnan( -3.14, -3.14 ); + t.strictEqual( bool, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `true` when both arguments are unequal non-NaN values', function test( t ) { + var bool; + + bool = dlaisnan( 1.0, 2.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( -1.0, 1.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( PINF, NINF ); + t.strictEqual( bool, true, 'returns expected value' ); + + bool = dlaisnan( 0.0, 1.0 ); + t.strictEqual( bool, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns expected values when passed the same variable as both arguments', function test( t ) { + var bool; + var x; + + x = NaN; + bool = dlaisnan( x, x ); + t.strictEqual( bool, true, 'returns expected value' ); + + x = 5.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = 0.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = -0.0; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + x = PINF; + bool = dlaisnan( x, x ); + t.strictEqual( bool, false, 'returns expected value' ); + + t.end(); +});