|
22 | 22 |
|
23 | 23 | var tape = require( 'tape' );
|
24 | 24 | var isnan = require( '@stdlib/math/base/assert/is-nan' );
|
| 25 | +var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); |
25 | 26 | var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
|
26 | 27 | var gsumpw = require( './../lib/ndarray.js' );
|
27 | 28 |
|
@@ -101,6 +102,28 @@ tape( 'the function calculates the sum of all strided array elements (accessors)
|
101 | 102 | t.end();
|
102 | 103 | });
|
103 | 104 |
|
| 105 | +tape( 'the function preserves the sign of zero', function test( t ) { |
| 106 | + var x; |
| 107 | + var v; |
| 108 | + |
| 109 | + x = [ -0.0, -0.0, -0.0, -0.0, -0.0 ]; |
| 110 | + v = gsumpw( x.length, x, 1, 0 ); |
| 111 | + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); |
| 112 | + |
| 113 | + t.end(); |
| 114 | +}); |
| 115 | + |
| 116 | +tape( 'the function preserves the sign of zero (accessors)', function test( t ) { |
| 117 | + var x; |
| 118 | + var v; |
| 119 | + |
| 120 | + x = [ -0.0, -0.0, -0.0, -0.0, -0.0 ]; |
| 121 | + v = gsumpw( x.length, toAccessorArray( x ), 1, 0 ); |
| 122 | + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); |
| 123 | + |
| 124 | + t.end(); |
| 125 | +}); |
| 126 | + |
104 | 127 | tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
|
105 | 128 | var x;
|
106 | 129 | var v;
|
|
0 commit comments