@stdlib/stats-array-nanminabs
v0.1.1
Published
Calculate the minimum absolute value of an array, ignoring NaN values.
Downloads
50
Readme
nanminabs
Calculate the minimum absolute value of an array, ignoring
NaNvalues.
Installation
npm install @stdlib/stats-array-nanminabsUsage
var nanminabs = require( '@stdlib/stats-array-nanminabs' );nanminabs( x )
Computes the minimum absolute value of an array, ignoring NaN values.
var x = [ 1.0, -2.0, NaN, 2.0 ];
var v = nanminabs( x );
// returns 1.0The function has the following parameters:
- x: input array.
Notes
- If provided an empty array, the function returns
NaN. - The function supports array-like objects having getter and setter accessors for array element access (e.g.,
@stdlib/array-base/accessor).
Examples
var uniform = require( '@stdlib/random-base-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var nanminabs = require( '@stdlib/stats-array-nanminabs' );
function rand() {
if ( bernoulli( 0.8 ) < 1 ) {
return NaN;
}
return uniform( -50.0, 50.0 );
}
var x = filledarrayBy( 10, 'float64', rand );
console.log( x );
var v = nanminabs( x );
console.log( v );Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
