You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/math/base/special/hypotf/test/test.native.js
+19-2
Original file line number
Diff line number
Diff line change
@@ -82,10 +82,22 @@ tape( 'the function returns `+infinity` if either argument is `+-infinity`', opt
82
82
h=hypotf(NINF,NINF);
83
83
t.strictEqual(h,PINF,'returns expected value');
84
84
85
+
h=hypotf(NaN,PINF);
86
+
t.strictEqual(h,PINF,'returns expected value');
87
+
88
+
h=hypotf(PINF,NaN);
89
+
t.strictEqual(h,PINF,'returns expected value');
90
+
91
+
h=hypotf(NINF,NaN);
92
+
t.strictEqual(h,PINF,'returns expected value');
93
+
94
+
h=hypotf(NaN,NINF);
95
+
t.strictEqual(h,PINF,'returns expected value');
96
+
85
97
t.end();
86
98
});
87
99
88
-
tape('the function returns `NaN` if either argument is `NaN`',opts,functiontest(t){
100
+
tape('the function returns `NaN` if either argument is `NaN` but not `+-infinity`',opts,functiontest(t){
89
101
varh;
90
102
91
103
h=hypotf(NaN,3.14);
@@ -145,6 +157,8 @@ tape( 'the function computes the hypotenuse', opts, function test( t ) {
145
157
});
146
158
147
159
tape('the function computes the hypotenuse (canonical inputs)',opts,functiontest(t){
160
+
vardelta;
161
+
vartol;
148
162
varh;
149
163
150
164
h=hypotf(3.0,4.0);
@@ -153,8 +167,11 @@ tape( 'the function computes the hypotenuse (canonical inputs)', opts, function
153
167
h=hypotf(6.0,8.0);
154
168
t.strictEqual(h,10.0,'returns expected value');
155
169
170
+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
0 commit comments