Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<!--

@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.

-->

# disnan

> LAPACK auxiliary routine to test whether a double-precision floating-point number is `NaN`.

<section class="usage">

## Usage

```javascript
var disnan = require( '@stdlib/lapack/base/disnan' );
```

#### disnan( x )

Tests whether a double-precision floating-point number is `NaN`.

```javascript
var bool = disnan( NaN );
// returns true

bool = disnan( 5.0 );
// returns false
```

The function has the following parameters:

- **x**: input value.

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- `disnan()` corresponds to the [LAPACK][lapack] auxiliary routine [`disnan`][lapack-disnan].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var disnan = require( '@stdlib/lapack/base/disnan' );

var opts = {
'dtype': 'float64'
};
var x = discreteUniform( 100, -50, 50, opts );

logEachMap( 'disnan( %d ) = %s', x, disnan );
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
TODO
```

#### TODO

TODO.

```c
TODO
```

TODO

```c
TODO
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
TODO
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[lapack]: https://www.netlib.org/lapack/explore-html/

[lapack-disnan]: https://www.netlib.org/lapack/explore-html/d0/d4c/group__isnan_ga7aa3164d5df8d883754b0a70e9c7209c.html

</section>

<!-- /.links -->
54 changes: 54 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @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 disnan = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var len;
var x;
var z;
var i;

len = 100;
x = uniform( len, -50, 50 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = disnan( x[ 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();
});
24 changes: 24 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

{{alias}}( x )
Tests whether a double-precision floating-point number is NaN.

Parameters
----------
x: number
Input value.

Returns
-------
bool: boolean
Boolean indicating whether an input value is NaN.

Examples
--------
> var bool = {{alias}}( NaN )
true
> bool = {{alias}}( 5.0 )
false

See Also
--------

40 changes: 40 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* @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

/**
* Tests whether a double-precision floating-point number is NaN.
*
* @param x - input value
* @returns boolean indicating whether an input value is NaN
*
* @example
* var bool = disnan( NaN );
* // returns true
*
* @example
* var bool = disnan( 5.0 );
* // returns false
*/
declare function disnan( x: number ): boolean;


// EXPORTS //

export = disnan;
42 changes: 42 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* @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 disnan = require( './index' );


// TESTS //

// The function returns a boolean...
{
disnan( 8 ); // $ExpectType boolean
}

// The compiler throws an error if the function is provided a value other than a number...
{
disnan( true ); // $ExpectError
disnan( false ); // $ExpectError
disnan( '5' ); // $ExpectError
disnan( [] ); // $ExpectError
disnan( {} ); // $ExpectError
disnan( ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided insufficient arguments...
{
disnan(); // $ExpectError
}
30 changes: 30 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/disnan/examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @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 disnan = require( './../lib' );

var opts = {
'dtype': 'float64'
};
var x = discreteUniform( 100, -50, 50, opts );

logEachMap( 'disnan( %d ) = %s', x, disnan );
Loading
Loading