diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/README.md b/lib/node_modules/@stdlib/stats/incr/nanminmax/README.md new file mode 100644 index 000000000000..d253ba8c33cf --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/README.md @@ -0,0 +1,155 @@ + + +# incrnanminmax + +> Compute a minimum and maximum incrementally, ignoring `NaN` values. + +
+ +## Usage + +```javascript +var incrnanminmax = require( '@stdlib/stats/incr/nanminmax' ); +``` + +#### incrnanminmax( \[out] ) + +Returns an accumulator function which incrementally computes a minimum and maximum, ignoring `NaN` values. + +```javascript +var accumulator = incrnanminmax(); +``` + +#### accumulator( \[x] ) + +If provided an input value `x`, the accumulator function returns updated minimum and maximum values. If not provided an input value `x`, the accumulator function returns the current minimum and maximum values. + +```javascript +var accumulator = incrnanminmax(); + +var mm = accumulator(); +// returns null + +mm = accumulator( 2.0 ); +// returns [ 2.0, 2.0 ] + +mm = accumulator( 1.0 ); +// returns [ 1.0, 2.0 ] + +mm = accumulator( 3.0 ); +// returns [ 1.0, 3.0 ] + +mm = accumulator( -7.0 ); +// returns [ -7.0, 3.0 ] + +mm = accumulator( NaN ); +// returns [ -7.0, 3.0 ] + +mm = accumulator( -5.0 ); +// returns [ -7.0, 3.0 ] + +mm = accumulator(); +// returns [ -7.0, 3.0 ] +``` + +
+ + + +
+ +## Notes + +- Input values are **not** type checked. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function. + +
+ + + +
+ +## Examples + + + +```javascript +var randu = require( '@stdlib/random/base/randu' ); +var incrnanminmax = require( '@stdlib/stats/incr/nanminmax' ); + +var accumulator; +var v; +var i; + +// Initialize an accumulator: +accumulator = incrnanminmax(); + +// For each simulated datum, update the minimum and maximum... +for ( i = 0; i < 100; i++ ) { + if ( randu() < 0.2 ) { + v = NaN; + } else { + v = randu() * 100.0; + } + accumulator( v ); +} +console.log( accumulator() ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanminmax/benchmark/benchmark.js new file mode 100644 index 000000000000..369745414825 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/benchmark/benchmark.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 randu = require( '@stdlib/random/base/randu' ); +var pkg = require( './../package.json' ).name; +var incrnanminmax = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var f; + var i; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + f = incrnanminmax(); + if ( typeof f !== 'function' ) { + b.fail( 'should return a function' ); + } + } + b.toc(); + if ( typeof f !== 'function' ) { + b.fail( 'should return a function' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::accumulator', function benchmark( b ) { + var acc; + var v; + var i; + + acc = incrnanminmax(); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = acc( randu() ); + if ( v.length !== 2 ) { + b.fail( 'should contain two elements' ); + } + } + b.toc(); + if ( v[ 0 ] !== v[ 0 ] || v[ 1 ] !== v[ 1 ] ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/repl.txt new file mode 100644 index 000000000000..4a5ec35d5c91 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/repl.txt @@ -0,0 +1,40 @@ + +{{alias}}( [out] ) + Returns an accumulator function which incrementally computes a minimum and + maximum, ignoring `NaN` values. + + If provided a value, the accumulator function returns an updated minimum and + maximum. If not provided a value, the accumulator function returns the + current minimum and maximum. + + Parameters + ---------- + out: Array|TypedArray (optional) + Output array. + + Returns + ------- + acc: Function + Accumulator function. + + Examples + -------- + > var accumulator = {{alias}}(); + > var mm = accumulator() + null + > mm = accumulator( 2.0 ) + [ 2.0, 2.0 ] + > mm = accumulator( -5.0 ) + [ -5.0, 2.0 ] + > mm = accumulator( 3.0 ) + [ -5.0, 3.0 ] + > mm = accumulator( NaN ) + [ -5.0, 3.0 ] + > mm = accumulator( 5.0 ) + [ -5.0, 5.0 ] + > mm = accumulator() + [ -5.0, 5.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/index.d.ts new file mode 100644 index 000000000000..69950d9d50da --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/index.d.ts @@ -0,0 +1,68 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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 + +/// + +import { ArrayLike } from '@stdlib/types/array'; + +/** +* If provided a value, the accumulator function returns updated minimum and maximum values. If not provided a value, the accumulator function returns the current minimum and maximum values. +* +* @param x - input value +* @returns output array or null +*/ +type accumulator = ( x?: number ) => ArrayLike | null; + +/** +* Returns an accumulator function which incrementally computes minimum and maximum values. +* +* @param out - output array +* @returns accumulator function +* +* @example +* var accumulator = incrnanminmax(); +* +* var mm = accumulator(); +* // returns null +* +* mm = accumulator( 2.0 ); +* // returns [ 2.0, 2.0 ] +* +* mm = accumulator( -5.0 ); +* // returns [ -5.0, 2.0 ] +* +* mm = accumulator( 3.0 ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( NaN ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( 5.0 ); +* // returns [ -5.0, 5.0 ] +* +* mm = accumulator(); +* // returns [ -5.0, 5.0 ] +*/ +declare function incrnanminmax( out?: ArrayLike ): accumulator; + + +// EXPORTS // + +export = incrnanminmax; diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/test.ts new file mode 100644 index 000000000000..ad697883cf09 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/docs/types/test.ts @@ -0,0 +1,61 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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 incrnanminmax = require( './index' ); + + +// TESTS // + +// The function returns an accumulator function... +{ + incrnanminmax(); // $ExpectType accumulator + const out = [ 0.0, 0.0 ]; + incrnanminmax( out ); // $ExpectType accumulator +} + +// The compiler throws an error if the function is provided an argument that is not an array-like object of numbers... +{ + incrnanminmax( '5' ); // $ExpectError + incrnanminmax( 5 ); // $ExpectError + incrnanminmax( true ); // $ExpectError + incrnanminmax( false ); // $ExpectError + incrnanminmax( null ); // $ExpectError + incrnanminmax( {} ); // $ExpectError + incrnanminmax( ( x: number ): number => x ); // $ExpectError +} + +// The function returns an accumulator function which returns an accumulated result... +{ + const acc = incrnanminmax(); + + acc(); // $ExpectType ArrayLike | null + acc( 3.14 ); // $ExpectType ArrayLike | null +} + +// The compiler throws an error if the returned accumulator function is provided invalid arguments... +{ + const acc = incrnanminmax(); + + acc( '5' ); // $ExpectError + acc( true ); // $ExpectError + acc( false ); // $ExpectError + acc( null ); // $ExpectError + acc( [] ); // $ExpectError + acc( {} ); // $ExpectError + acc( ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanminmax/examples/index.js new file mode 100644 index 000000000000..409a7ecb827d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/examples/index.js @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 randu = require( '@stdlib/random/base/randu' ); +var incrnanminmax = require( './../lib' ); + +var accumulator; +var mm; +var v; +var i; + +// Initialize an accumulator: +accumulator = incrnanminmax(); + +// For each simulated datum, update the minimum and maximum... +console.log( '\nValue\tMin\tMax\n' ); +for ( i = 0; i < 100; i++ ) { + if ( randu() < 0.2 ) { + v = NaN; + } else { + v = randu() * 100.0; + } + mm = accumulator( v ); + console.log( '%d\t%d\t%d', v.toFixed( 4 ), ( mm === null ) ? NaN : mm[ 0 ].toFixed( 4 ), ( mm === null ) ? NaN : mm[ 1 ].toFixed( 4 ) ); +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/index.js new file mode 100644 index 000000000000..4d19e0f3fdd7 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/index.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +/** +* Compute a minimum and maximum incrementally, ignoring `NaN` values. +* +* @module @stdlib/stats/incr/nanminmax +* +* @example +* var incrnanminmax = require( '@stdlib/stats/incr/nanminmax' ); +* +* var accumulator = incrnanminmax(); +* +* var mm = accumulator(); +* // returns null +* +* mm = accumulator( 2.0 ); +* // returns [ 2.0, 2.0 ] +* +* mm = accumulator( -5.0 ); +* // returns [ -5.0, 2.0 ] +* +* mm = accumulator( 3.0 ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( NaN ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( 5.0 ); +* // returns [ -5.0, 5.0 ] +* +* mm = accumulator(); +* // returns [ -5.0, 5.0 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/main.js new file mode 100644 index 000000000000..5f2d4b133342 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/lib/main.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var incrminmax = require( '@stdlib/stats/incr/minmax' ); + + +// MAIN // + +/** +* Returns an accumulator function which incrementally computes minimum and maximum values, ignoring `NaN` values. +* +* @param {Collection} [out] - output array +* @returns {Function} accumulator function +* +* @example +* var accumulator = incrnanminmax(); +* +* var mm = accumulator(); +* // returns null +* +* mm = accumulator( 2.0 ); +* // returns [ 2.0, 2.0 ] +* +* mm = accumulator( -5.0 ); +* // returns [ -5.0, 2.0 ] +* +* mm = accumulator( 3.0 ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( NaN ); +* // returns [ -5.0, 3.0 ] +* +* mm = accumulator( 5.0 ); +* // returns [ -5.0, 5.0 ] +* +* mm = accumulator(); +* // returns [ -5.0, 5.0 ] +*/ +function incrnanminmax( out ) { + var minmax; + if ( arguments.length === 0 ) { + minmax = incrminmax(); + } else { + minmax = incrminmax( out ); + } + return accumulator; + + /** + * If provided a value, the accumulator function returns updated minimum and maximum values. If not provided a value, the accumulator function returns the current minimum and maximum values. + * + * @private + * @param {number} [x] - input value + * @returns {(ArrayLikeObject|null)} output array or null + */ + function accumulator( x ) { + if ( arguments.length === 0 || isnan( x ) ) { + return minmax(); + } + return minmax( x ); + } +} + + +// EXPORTS // + +module.exports = incrnanminmax; diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/package.json b/lib/node_modules/@stdlib/stats/incr/nanminmax/package.json new file mode 100644 index 000000000000..778cd69e0378 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/stats/incr/nanminmax", + "version": "0.0.0", + "description": "Compute a minimum and maximum incrementally, ignoring NaN values.", + "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", + "statistics", + "stats", + "mathematics", + "math", + "maximum", + "max", + "minimum", + "min", + "dispersion", + "variance", + "range", + "extent", + "extrema", + "incremental", + "accumulator" + ] +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanminmax/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanminmax/test/test.js new file mode 100644 index 000000000000..9a4ef628ccab --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanminmax/test/test.js @@ -0,0 +1,223 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); +var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); +var incrnanminmax = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof incrnanminmax, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if not provided an array-like object for an output argument', function test( t ) { + var values; + var i; + + values = [ + '5', + -5.0, + true, + false, + null, + void 0, + NaN, + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + incrnanminmax( value ); + }; + } +}); + +tape( 'the function returns an accumulator function', function test( t ) { + t.equal( typeof incrnanminmax(), 'function', 'returns a function' ); + t.end(); +}); + +tape( 'the function returns an accumulator function (output)', function test( t ) { + t.equal( typeof incrnanminmax( [ 0.0, 0.0 ] ), 'function', 'returns a function' ); + t.end(); +}); + +tape( 'the accumulator function computes a minimum and maximum incrementally', function test( t ) { + var expected; + var actual; + var data; + var acc; + var N; + var i; + + data = [ 2.0, 3.0, 2.0, 4.0, NaN, 4.0, 2.0, 2.0, NaN, 1.0, 0.0, 4.0, -1.0 ]; + N = data.length; + + acc = incrnanminmax(); + + actual = []; + for ( i = 0; i < N; i++ ) { + actual.push( ( acc( data[ i ] ) ).slice() ); + } + expected = [ + [ 2.0, 2.0 ], + [ 2.0, 3.0 ], + [ 2.0, 3.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 1.0, 4.0 ], + [ 0.0, 4.0 ], + [ 0.0, 4.0 ], + [ -1.0, 4.0 ] + ]; + + t.deepEqual( actual, expected, 'returns expected values' ); + t.end(); +}); + +tape( 'the accumulator function computes a minimum and maximum incrementally (output)', function test( t ) { + var expected; + var actual; + var data; + var acc; + var out; + var N; + var i; + + data = [ 2.0, 3.0, 2.0, 4.0, NaN, 4.0, 2.0, 2.0, NaN, 1.0, 0.0, 4.0, -1.0 ]; + N = data.length; + + out = [ 0.0, 0.0 ]; + acc = incrnanminmax( out ); + + actual = []; + for ( i = 0; i < N; i++ ) { + actual.push( acc( data[ i ] ) ); + t.equal( actual[ i ], out, 'returns output array' ); + actual[ i ] = actual[ i ].slice(); + } + expected = [ + [ 2.0, 2.0 ], + [ 2.0, 3.0 ], + [ 2.0, 3.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 2.0, 4.0 ], + [ 1.0, 4.0 ], + [ 0.0, 4.0 ], + [ 0.0, 4.0 ], + [ -1.0, 4.0 ] + ]; + + t.deepEqual( actual, expected, 'returns expected values' ); + t.end(); +}); + +tape( 'if not provided an input value, the accumulator function returns the current minimum and maximum values', function test( t ) { + var data; + var acc; + var i; + + data = [ 2.0, 3.0, 5.0, 4.0 ]; + acc = incrnanminmax(); + for ( i = 0; i < data.length; i++ ) { + acc( data[ i ] ); + } + t.deepEqual( acc(), [ 2.0, 5.0 ], 'returns expected value' ); + t.end(); +}); + +tape( 'if data has yet to be provided, the accumulator function returns `null`', function test( t ) { + var acc = incrnanminmax(); + t.equal( acc(), null, 'returns null' ); + t.end(); +}); + +tape( 'the accumulator function correctly handles signed zeros', function test( t ) { + var acc; + var v; + + acc = incrnanminmax(); + + v = acc( 0.0 ); + t.equal( isPositiveZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isPositiveZero( v[ 1 ] ), true, 'returns expected value' ); + + v = acc( -0.0 ); + t.equal( isNegativeZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isPositiveZero( v[ 1 ] ), true, 'returns expected value' ); + + v = acc( 0.0 ); + t.equal( isNegativeZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isPositiveZero( v[ 1 ] ), true, 'returns expected value' ); + + acc = incrnanminmax(); + + v = acc( -0.0 ); + t.equal( isNegativeZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isNegativeZero( v[ 1 ] ), true, 'returns expected value' ); + + v = acc( 0.0 ); + t.equal( isNegativeZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isPositiveZero( v[ 1 ] ), true, 'returns expected value' ); + + v = acc( -0.0 ); + t.equal( isNegativeZero( v[ 0 ] ), true, 'returns expected value' ); + t.equal( isPositiveZero( v[ 1 ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided `NaN`, the accumulated minimum and maximum values remain unchanged', function test( t ) { + var data; + var acc; + var v; + var i; + + data = [ 2.0, NaN, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]; + acc = incrnanminmax(); + for ( i = 0; i < data.length; i++ ) { + acc( data[ i ] ); + } + v = acc(); + t.equal( v[ 0 ], 1.0, 'returns expected value' ); + t.equal( v[ 1 ], 7.0, 'returns expected value' ); + t.end(); +});