Skip to content

Commit d0c1c2b

Browse files
test: add tests for IEEE 754-2019 compliance
PR-URL: #6558 Ref: #365 Reviewed-by: Athan Reines <[email protected]>
1 parent 3e268db commit d0c1c2b

File tree

12 files changed

+124
-16
lines changed

12 files changed

+124
-16
lines changed

lib/node_modules/@stdlib/math/base/special/cos/test/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,15 @@ tape( 'the function returns `NaN` if provided a `-infinity`', function test( t )
214214
t.equal( isnan( v ), true, 'returns expected value' );
215215
t.end();
216216
});
217+
218+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
219+
var v;
220+
221+
v = cos( -0.0 );
222+
t.equal( v, 1.0, 'returns expected value' );
223+
224+
v = cos( +0.0 );
225+
t.equal( v, 1.0, 'returns expected value' );
226+
227+
t.end();
228+
});

lib/node_modules/@stdlib/math/base/special/cos/test/test.native.js

+12
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,15 @@ tape( 'the function returns `NaN` if provided a `-infinity`', opts, function tes
223223
t.equal( isnan( v ), true, 'returns expected value' );
224224
t.end();
225225
});
226+
227+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
228+
var v;
229+
230+
v = cos( -0.0 );
231+
t.equal( v, 1.0, 'returns expected value' );
232+
233+
v = cos( +0.0 );
234+
t.equal( v, 1.0, 'returns expected value' );
235+
236+
t.end();
237+
});

lib/node_modules/@stdlib/math/base/special/cosh/test/test.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,15 @@ tape( 'the function computes the hyperbolic cosine (large values)', function tes
116116
t.end();
117117
});
118118

119-
tape( 'the function returns `1` if provided `0`', function test( t ) {
120-
var v = cosh( 0 );
119+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
120+
var v;
121+
122+
v = cosh( -0.0 );
123+
t.equal( v, 1.0, 'returns expected value' );
124+
125+
v = cosh( +0.0 );
121126
t.equal( v, 1.0, 'returns expected value' );
127+
122128
t.end();
123129
});
124130

lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,15 @@ tape( 'the function computes the hyperbolic cosine (large values)', opts, functi
125125
t.end();
126126
});
127127

128-
tape( 'the function returns `1` if provided `0`', opts, function test( t ) {
129-
var v = cosh( 0 );
128+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
129+
var v;
130+
131+
v = cosh( -0.0 );
132+
t.equal( v, 1.0, 'returns expected value' );
133+
134+
v = cosh( +0.0 );
130135
t.equal( v, 1.0, 'returns expected value' );
136+
131137
t.end();
132138
});
133139

lib/node_modules/@stdlib/math/base/special/cospi/test/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) {
6464
t.end();
6565
});
6666

67+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
68+
var y;
69+
70+
y = cospi( -0.0 );
71+
t.equal( y, 1.0, 'returns expected value' );
72+
73+
y = cospi( +0.0 );
74+
t.equal( y, 1.0, 'returns expected value' );
75+
76+
t.end();
77+
});
78+
6779
tape( 'if provided an integer, the function returns `+-1.0`', function test( t ) {
6880
var expected;
6981
var x;

lib/node_modules/@stdlib/math/base/special/cospi/test/test.native.js

+12
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t )
7373
t.end();
7474
});
7575

76+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
77+
var y;
78+
79+
y = cospi( -0.0 );
80+
t.equal( y, 1.0, 'returns expected value' );
81+
82+
y = cospi( +0.0 );
83+
t.equal( y, 1.0, 'returns expected value' );
84+
85+
t.end();
86+
});
87+
7688
tape( 'if provided an integer, the function returns `+-1.0`', opts, function test( t ) {
7789
var expected;
7890
var x;

lib/node_modules/@stdlib/math/base/special/exp/test/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,15 @@ tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) {
163163
t.equal( isnan( val ), true, 'returns NaN' );
164164
t.end();
165165
});
166+
167+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
168+
var val;
169+
170+
val = exp( -0.0 );
171+
t.equal( val, 1.0, 'returns expected value' );
172+
173+
val = exp( +0.0 );
174+
t.equal( val, 1.0, 'returns expected value' );
175+
176+
t.end();
177+
});

lib/node_modules/@stdlib/math/base/special/exp/test/test.native.js

+12
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,15 @@ tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t )
172172
t.equal( isnan( val ), true, 'returns NaN' );
173173
t.end();
174174
});
175+
176+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
177+
var val;
178+
179+
val = exp( -0.0 );
180+
t.equal( val, 1.0, 'returns expected value' );
181+
182+
val = exp( +0.0 );
183+
t.equal( val, 1.0, 'returns expected value' );
184+
185+
t.end();
186+
});

lib/node_modules/@stdlib/math/base/special/exp10/test/test.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,15 @@ tape( 'the function returns `+infinity` if provided `+infinity`', function test(
170170
t.end();
171171
});
172172

173-
tape( 'the function returns `1` if provided `0`', function test( t ) {
174-
var v = exp10( 0.0 );
175-
t.equal( v, 1.0, 'equals 1' );
173+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
174+
var val;
175+
176+
val = exp10( -0.0 );
177+
t.equal( val, 1.0, 'returns expected value' );
178+
179+
val = exp10( +0.0 );
180+
t.equal( val, 1.0, 'returns expected value' );
181+
176182
t.end();
177183
});
178184

lib/node_modules/@stdlib/math/base/special/exp10/test/test.native.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,15 @@ tape( 'the function returns `+infinity` if provided `+infinity`', opts, function
179179
t.end();
180180
});
181181

182-
tape( 'the function returns `1` if provided `0`', opts, function test( t ) {
183-
var v = exp10( 0.0 );
184-
t.equal( v, 1.0, 'equals 1' );
182+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
183+
var val;
184+
185+
val = exp10( -0.0 );
186+
t.equal( val, 1.0, 'returns expected value' );
187+
188+
val = exp10( +0.0 );
189+
t.equal( val, 1.0, 'returns expected value' );
190+
185191
t.end();
186192
});
187193

lib/node_modules/@stdlib/math/base/special/exp2/test/test.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,15 @@ tape( 'the function returns `+infinity` if provided `+infinity`', function test(
170170
t.end();
171171
});
172172

173-
tape( 'the function returns `1` if provided `0`', function test( t ) {
174-
var v = exp2( 0.0 );
175-
t.equal( v, 1.0, 'equals 1' );
173+
tape( 'the function returns `1` if provided `+-0`', function test( t ) {
174+
var v;
175+
176+
v = exp2( -0.0 );
177+
t.equal( v, 1.0, 'returns expected value' );
178+
179+
v = exp2( +0.0 );
180+
t.equal( v, 1.0, 'returns expected value' );
181+
176182
t.end();
177183
});
178184

lib/node_modules/@stdlib/math/base/special/exp2/test/test.native.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,15 @@ tape( 'the function returns `+infinity` if provided `+infinity`', opts, function
179179
t.end();
180180
});
181181

182-
tape( 'the function returns `1` if provided `0`', opts, function test( t ) {
183-
var v = exp2( 0.0 );
184-
t.equal( v, 1.0, 'equals 1' );
182+
tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) {
183+
var v;
184+
185+
v = exp2( -0.0 );
186+
t.equal( v, 1.0, 'returns expected value' );
187+
188+
v = exp2( +0.0 );
189+
t.equal( v, 1.0, 'returns expected value' );
190+
185191
t.end();
186192
});
187193

0 commit comments

Comments
 (0)