@@ -78,7 +78,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
7878 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
7979 } else {
8080 delta = abs ( y - expected [ i ] ) ;
81- tol = EPS * abs ( expected [ i ] ) ;
81+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
8282 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
8383 }
8484 }
@@ -101,7 +101,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
101101 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
102102 } else {
103103 delta = abs ( y - expected [ i ] ) ;
104- tol = EPS * abs ( expected [ i ] ) ;
104+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
105105 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
106106 }
107107 }
@@ -124,7 +124,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
124124 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
125125 } else {
126126 delta = abs ( y - expected [ i ] ) ;
127- tol = EPS * abs ( expected [ i ] ) ;
127+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
128128 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
129129 }
130130 }
@@ -147,7 +147,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
147147 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
148148 } else {
149149 delta = abs ( y - expected [ i ] ) ;
150- tol = EPS * abs ( expected [ i ] ) ;
150+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
151151 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
152152 }
153153 }
@@ -170,7 +170,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
170170 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
171171 } else {
172172 delta = abs ( y - expected [ i ] ) ;
173- tol = EPS * abs ( expected [ i ] ) ;
173+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
174174 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
175175 }
176176 }
@@ -193,7 +193,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
193193 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
194194 } else {
195195 delta = abs ( y - expected [ i ] ) ;
196- tol = EPS * abs ( expected [ i ] ) ;
196+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
197197 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
198198 }
199199 }
@@ -216,7 +216,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
216216 t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
217217 } else {
218218 delta = abs ( y - expected [ i ] ) ;
219- tol = EPS * abs ( expected [ i ] ) ;
219+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
220220 t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
221221 }
222222 }
@@ -225,6 +225,8 @@ tape( 'the function evaluates the complementary error function for `x` on the in
225225
226226tape ( 'the function evaluates the complementary error function for `x` on the interval `[0.8,1]`' , opts , function test ( t ) {
227227 var expected ;
228+ var delta ;
229+ var tol ;
228230 var x ;
229231 var y ;
230232 var i ;
@@ -233,13 +235,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
233235 x = smallPositive . x ;
234236 for ( i = 0 ; i < x . length ; i ++ ) {
235237 y = erfc ( x [ i ] ) ;
236- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
238+ if ( y === expected [ i ] ) {
239+ t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
240+ } else {
241+ delta = abs ( y - expected [ i ] ) ;
242+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
243+ t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
244+ }
237245 }
238246 t . end ( ) ;
239247} ) ;
240248
241249tape ( 'the function evaluates the complementary error function for `x` on the interval `[-0.8,0.8]`' , opts , function test ( t ) {
242250 var expected ;
251+ var delta ;
252+ var tol ;
243253 var x ;
244254 var y ;
245255 var i ;
@@ -248,13 +258,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
248258 x = smaller . x ;
249259 for ( i = 0 ; i < x . length ; i ++ ) {
250260 y = erfc ( x [ i ] ) ;
251- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
261+ if ( y === expected [ i ] ) {
262+ t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
263+ } else {
264+ delta = abs ( y - expected [ i ] ) ;
265+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
266+ t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
267+ }
252268 }
253269 t . end ( ) ;
254270} ) ;
255271
256272tape ( 'the function evaluates the complementary error function for `x` on the interval `[-1e-300,-1e-308]`' , opts , function test ( t ) {
257273 var expected ;
274+ var delta ;
275+ var tol ;
258276 var x ;
259277 var y ;
260278 var i ;
@@ -263,13 +281,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
263281 x = tinyNegative . x ;
264282 for ( i = 0 ; i < x . length ; i ++ ) {
265283 y = erfc ( x [ i ] ) ;
266- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
284+ if ( y === expected [ i ] ) {
285+ t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
286+ } else {
287+ delta = abs ( y - expected [ i ] ) ;
288+ tol = 1.0 * EPS * abs ( expected [ i ] ) ;
289+ t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
290+ }
267291 }
268292 t . end ( ) ;
269293} ) ;
270294
271295tape ( 'the function evaluates the complementary error function for `x` on the interval `[1e-300,1e-308]`' , opts , function test ( t ) {
272296 var expected ;
297+ var delta ;
298+ var tol ;
273299 var x ;
274300 var y ;
275301 var i ;
@@ -278,13 +304,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
278304 x = tinyPositive . x ;
279305 for ( i = 0 ; i < x . length ; i ++ ) {
280306 y = erfc ( x [ i ] ) ;
281- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
307+ if ( y === expected [ i ] ) {
308+ t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
309+ } else {
310+ delta = abs ( y - expected [ i ] ) ;
311+ tol = 1.0 * EPS * abs ( expected [ i ] ) ;
312+ t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
313+ }
282314 }
283315 t . end ( ) ;
284316} ) ;
285317
286318tape ( 'the function evaluates the complementary error function for subnormal `x`' , opts , function test ( t ) {
287319 var expected ;
320+ var delta ;
321+ var tol ;
288322 var x ;
289323 var y ;
290324 var i ;
@@ -293,7 +327,13 @@ tape( 'the function evaluates the complementary error function for subnormal `x`
293327 x = subnormal . x ;
294328 for ( i = 0 ; i < x . length ; i ++ ) {
295329 y = erfc ( x [ i ] ) ;
296- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
330+ if ( y === expected [ i ] ) {
331+ t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
332+ } else {
333+ delta = abs ( y - expected [ i ] ) ;
334+ tol = 1.0 * EPS * abs ( expected [ i ] ) ;
335+ t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
336+ }
297337 }
298338 t . end ( ) ;
299339} ) ;
0 commit comments