|
20 | 20 |
|
21 | 21 | /// <reference types="@stdlib/types"/> |
22 | 22 |
|
23 | | -import { Complex128Array, Complex64Array, AnyArray, FloatingPointDataType } from '@stdlib/types/array'; |
| 23 | +import { Complex128Array, Complex64Array, Float16Array, AnyArray, FloatingPointDataType } from '@stdlib/types/array'; |
24 | 24 |
|
25 | 25 | /** |
26 | 26 | * Data type. |
@@ -63,6 +63,24 @@ declare function nansLike( x: AnyArray, dtype: 'float64' ): Float64Array; |
63 | 63 | */ |
64 | 64 | declare function nansLike( x: AnyArray, dtype: 'float32' ): Float32Array; |
65 | 65 |
|
| 66 | +/** |
| 67 | +* Creates an array filled with NaNs and having the same length as a provided input array. |
| 68 | +* |
| 69 | +* @param x - input array from which to derive the output array length |
| 70 | +* @param dtype - data type |
| 71 | +* @returns filled array |
| 72 | +* |
| 73 | +* @example |
| 74 | +* var zeros = require( '@stdlib/array/zeros' ); |
| 75 | +* |
| 76 | +* var x = zeros( 2, 'float64' ); |
| 77 | +* // returns <Float64Array>[ 0.0, 0.0 ] |
| 78 | +* |
| 79 | +* var y = nansLike( x, 'float16' ); |
| 80 | +* // returns <Float16Array>[ NaN, NaN ] |
| 81 | +*/ |
| 82 | +declare function nansLike( x: AnyArray, dtype: 'float16' ): Float16Array; |
| 83 | + |
66 | 84 | /** |
67 | 85 | * Creates an array filled with NaNs and having the same length as a provided input array. |
68 | 86 | * |
@@ -177,6 +195,33 @@ declare function nansLike( x: Float64Array, dtype?: DataType ): Float64Array; |
177 | 195 | */ |
178 | 196 | declare function nansLike( x: Float32Array, dtype?: DataType ): Float32Array; |
179 | 197 |
|
| 198 | +/** |
| 199 | +* Creates an array filled with NaNs and having the same length and data type as a provided input array. |
| 200 | +* |
| 201 | +* The function supports the following data types: |
| 202 | +* |
| 203 | +* - `float64`: double-precision floating-point numbers (IEEE 754) |
| 204 | +* - `float32`: single-precision floating-point numbers (IEEE 754) |
| 205 | +* - `float16`: half-precision floating-point numbers (IEEE 754) |
| 206 | +* - `complex128`: double-precision complex floating-point numbers |
| 207 | +* - `complex64`: single-precision complex floating-point numbers |
| 208 | +* - `generic`: generic JavaScript values |
| 209 | +* |
| 210 | +* @param x - input array from which to derive the output array length |
| 211 | +* @param dtype - data type |
| 212 | +* @returns filled array |
| 213 | +* |
| 214 | +* @example |
| 215 | +* var zeros = require( '@stdlib/array/zeros' ); |
| 216 | +* |
| 217 | +* var x = zeros( 2, 'float16' ); |
| 218 | +* // returns <Float16Array>[ 0.0, 0.0 ] |
| 219 | +* |
| 220 | +* var y = nansLike( x ); |
| 221 | +* // returns <Float16Array>[ NaN, NaN ] |
| 222 | +*/ |
| 223 | +declare function nansLike( x: Float16Array, dtype?: DataType ): Float16Array; |
| 224 | + |
180 | 225 | /** |
181 | 226 | * Creates an array filled with NaNs and having the same length and data type as a provided input array. |
182 | 227 | * |
|
0 commit comments