Skip to content

Commit ce9912f

Browse files
committed
Auto-generated commit
1 parent e44052f commit ce9912f

File tree

11 files changed

+499
-1
lines changed

11 files changed

+499
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-01-08)
7+
## Unreleased (2026-01-09)
88

99
<section class="features">
1010

1111
### Features
1212

13+
- [`aebc415`](https://github.com/stdlib-js/stdlib/commit/aebc415cd7b1579ef8935576eb4fae94a4277846) - add `number/float16/base/assert/is-nan` [(#9625)](https://github.com/stdlib-js/stdlib/pull/9625)
1314
- [`da01e3d`](https://github.com/stdlib-js/stdlib/commit/da01e3d2071bb474ecef81e1d8ab07561f4b78f5) - add `number/float16/base/sub` [(#9558)](https://github.com/stdlib-js/stdlib/pull/9558)
1415
- [`5301fb5`](https://github.com/stdlib-js/stdlib/commit/5301fb5c6146068494dfa645007e823aa0777f84) - add `number/float16/base/assert/is-almost-equal` [(#9500)](https://github.com/stdlib-js/stdlib/pull/9500)
1516
- [`cf0cdff`](https://github.com/stdlib-js/stdlib/commit/cf0cdffe3fc2d824130089cac3bd8f7f0c717dc4) - add `number/float16/base/signbit` [(#9390)](https://github.com/stdlib-js/stdlib/pull/9390)
@@ -162,6 +163,7 @@ A total of 19 issues were closed in this release:
162163

163164
<details>
164165

166+
- [`aebc415`](https://github.com/stdlib-js/stdlib/commit/aebc415cd7b1579ef8935576eb4fae94a4277846) - **feat:** add `number/float16/base/assert/is-nan` [(#9625)](https://github.com/stdlib-js/stdlib/pull/9625) _(by Lokesh Ranjan)_
165167
- [`056ece8`](https://github.com/stdlib-js/stdlib/commit/056ece8dfb301d321667f266232a4c9833f4380e) - **chore:** update meta data _(by Athan Reines)_
166168
- [`da01e3d`](https://github.com/stdlib-js/stdlib/commit/da01e3d2071bb474ecef81e1d8ab07561f4b78f5) - **feat:** add `number/float16/base/sub` [(#9558)](https://github.com/stdlib-js/stdlib/pull/9558) _(by Lokesh Ranjan, Philipp Burckhardt)_
167169
- [`5301fb5`](https://github.com/stdlib-js/stdlib/commit/5301fb5c6146068494dfa645007e823aa0777f84) - **feat:** add `number/float16/base/assert/is-almost-equal` [(#9500)](https://github.com/stdlib-js/stdlib/pull/9500) _(by Neeraj Pathak, Philipp Burckhardt)_
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 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+
# isnan
22+
23+
> Test if a half-precision floating-point numeric value is NaN.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var isnan = require( '@stdlib/number/float16/base/assert/is-nan' );
31+
```
32+
33+
#### isnan( x )
34+
35+
Tests if a half-precision floating-point `numeric` value is `NaN`.
36+
37+
```javascript
38+
var bool = isnan( NaN );
39+
// returns true
40+
```
41+
42+
</section>
43+
44+
<!-- /.usage -->
45+
46+
<section class="examples">
47+
48+
## Examples
49+
50+
<!-- eslint no-undef: "error" -->
51+
52+
```javascript
53+
var isnan = require( '@stdlib/number/float16/base/assert/is-nan' );
54+
55+
var bool = isnan( NaN );
56+
// returns true
57+
58+
bool = isnan( 5.0 );
59+
// returns false
60+
```
61+
62+
</section>
63+
64+
<!-- /.examples -->
65+
66+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
67+
68+
<section class="related">
69+
70+
</section>
71+
72+
<!-- /.related -->
73+
74+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
75+
76+
<section class="links">
77+
78+
</section>
79+
80+
<!-- /.links -->
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var toFloat16 = require( './../../../../../float64/base/to-float16' );
26+
var map = require( '@stdlib/array/base/map' );
27+
var naryFunction = require( '@stdlib/utils/nary-function' );
28+
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
29+
var pkg = require( './../package.json' ).name;
30+
var isnan = require( './../lib' );
31+
32+
33+
// MAIN //
34+
35+
bench( pkg, function benchmark( b ) {
36+
var x;
37+
var y;
38+
var i;
39+
40+
x = map( uniform( 100, -5.0e6, 5.0e6 ), naryFunction( toFloat16, 1 ) );
41+
42+
b.tic();
43+
for ( i = 0; i < b.iterations; i++ ) {
44+
y = isnan( x[ i%x.length ] );
45+
if ( typeof y !== 'boolean' ) {
46+
b.fail( 'should return a boolean' );
47+
}
48+
}
49+
b.toc();
50+
if ( !isBoolean( y ) ) {
51+
b.fail( 'should return a boolean' );
52+
}
53+
b.pass( 'benchmark finished' );
54+
b.end();
55+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
{{alias}}( x )
3+
Tests if a half-precision floating-point numeric value is `NaN`.
4+
5+
Parameters
6+
----------
7+
x: number
8+
Value to test.
9+
10+
Returns
11+
-------
12+
bool: boolean
13+
Boolean indicating whether the value is `NaN`.
14+
15+
Examples
16+
--------
17+
> var bool = {{alias}}( NaN )
18+
true
19+
> bool = {{alias}}( 7.0 )
20+
false
21+
22+
See Also
23+
--------
24+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Tests if a half-precision floating-point numeric value is `NaN`.
23+
*
24+
* @param x - value to test
25+
* @returns boolean indicating whether the value is `NaN`
26+
*
27+
* @example
28+
* var bool = isnan( NaN );
29+
* // returns true
30+
*
31+
* @example
32+
* var bool = isnan( 7.0 );
33+
* // returns false
34+
*/
35+
declare function isnan( x: number ): boolean;
36+
37+
38+
// EXPORTS //
39+
40+
export = isnan;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isnan = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isnan( NaN ); // $ExpectType boolean
27+
isnan( 2 ); // $ExpectType boolean
28+
isnan( 3 ); // $ExpectType boolean
29+
}
30+
31+
// The compiler throws an error if the function is provided a value other than a number...
32+
{
33+
isnan( true ); // $ExpectError
34+
isnan( false ); // $ExpectError
35+
isnan( null ); // $ExpectError
36+
isnan( undefined ); // $ExpectError
37+
isnan( [] ); // $ExpectError
38+
isnan( {} ); // $ExpectError
39+
isnan( ( x: number ): number => x ); // $ExpectError
40+
}
41+
42+
// The compiler throws an error if the function is provided an unsupported number of arguments...
43+
{
44+
isnan(); // $ExpectError
45+
isnan( undefined, 123 ); // $ExpectError
46+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
var isnan = require( './../lib' );
22+
23+
console.log( isnan( NaN ) );
24+
// => true
25+
26+
console.log( isnan( 5 ) );
27+
// => false
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* Test if a half-precision floating-point numeric value is `NaN`.
23+
*
24+
* @module @stdlib/number/float16/base/assert/is-nan
25+
*
26+
* @example
27+
* var isnan = require( '@stdlib/number/float16/base/assert/is-nan' );
28+
*
29+
* var bool = isnan( NaN );
30+
* // returns true
31+
*
32+
* bool = isnan( 7.0 );
33+
* // returns false
34+
*/
35+
36+
// MODULES //
37+
38+
var main = require( './main.js' );
39+
40+
41+
// EXPORTS //
42+
43+
module.exports = main;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MAIN //
22+
23+
/**
24+
* Tests if a half-precision floating-point numeric value is `NaN`.
25+
*
26+
* @param {number} x - value to test
27+
* @returns {boolean} boolean indicating whether the value is `NaN`
28+
*
29+
* @example
30+
* var bool = isnan( NaN );
31+
* // returns true
32+
*
33+
* @example
34+
* var bool = isnan( 7.0 );
35+
* // returns false
36+
*/
37+
function isnan( x ) {
38+
return ( x !== x );
39+
}
40+
41+
42+
// EXPORTS //
43+
44+
module.exports = isnan;

0 commit comments

Comments
 (0)