|
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 gsumors = require( './../lib/ndarray.js' );
|
27 | 28 |
|
@@ -93,6 +94,28 @@ tape( 'the function calculates the sum of all strided array elements (accessors)
|
93 | 94 | t.end();
|
94 | 95 | });
|
95 | 96 |
|
| 97 | +tape( 'the function preserves the sign of zero', function test( t ) { |
| 98 | + var x; |
| 99 | + var v; |
| 100 | + |
| 101 | + x = [ -0.0, -0.0, -0.0, -0.0, -0.0 ]; |
| 102 | + v = gsumors( x.length, x, 1, 0 ); |
| 103 | + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); |
| 104 | + |
| 105 | + t.end(); |
| 106 | +}); |
| 107 | + |
| 108 | +tape( 'the function preserves the sign of zero (accessors)', function test( t ) { |
| 109 | + var x; |
| 110 | + var v; |
| 111 | + |
| 112 | + x = [ -0.0, -0.0, -0.0, -0.0, -0.0 ]; |
| 113 | + v = gsumors( x.length, toAccessorArray( x ), 1, 0 ); |
| 114 | + t.strictEqual( isNegativeZero( v ), true, 'returns expected value' ); |
| 115 | + |
| 116 | + t.end(); |
| 117 | +}); |
| 118 | + |
96 | 119 | tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
|
97 | 120 | var x;
|
98 | 121 | var v;
|
|
0 commit comments