@@ -78,7 +78,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
78
78
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
79
79
} else {
80
80
delta = abs ( y - expected [ i ] ) ;
81
- tol = EPS * abs ( expected [ i ] ) ;
81
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
82
82
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
83
83
}
84
84
}
@@ -101,7 +101,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
101
101
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
102
102
} else {
103
103
delta = abs ( y - expected [ i ] ) ;
104
- tol = EPS * abs ( expected [ i ] ) ;
104
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
105
105
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
106
106
}
107
107
}
@@ -124,7 +124,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
124
124
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
125
125
} else {
126
126
delta = abs ( y - expected [ i ] ) ;
127
- tol = EPS * abs ( expected [ i ] ) ;
127
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
128
128
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
129
129
}
130
130
}
@@ -147,7 +147,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
147
147
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
148
148
} else {
149
149
delta = abs ( y - expected [ i ] ) ;
150
- tol = EPS * abs ( expected [ i ] ) ;
150
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
151
151
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
152
152
}
153
153
}
@@ -170,7 +170,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
170
170
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
171
171
} else {
172
172
delta = abs ( y - expected [ i ] ) ;
173
- tol = EPS * abs ( expected [ i ] ) ;
173
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
174
174
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
175
175
}
176
176
}
@@ -193,7 +193,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
193
193
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
194
194
} else {
195
195
delta = abs ( y - expected [ i ] ) ;
196
- tol = EPS * abs ( expected [ i ] ) ;
196
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
197
197
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
198
198
}
199
199
}
@@ -216,7 +216,7 @@ tape( 'the function evaluates the complementary error function for `x` on the in
216
216
t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
217
217
} else {
218
218
delta = abs ( y - expected [ i ] ) ;
219
- tol = EPS * abs ( expected [ i ] ) ;
219
+ tol = 2.0 * EPS * abs ( expected [ i ] ) ;
220
220
t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol ) ;
221
221
}
222
222
}
@@ -225,6 +225,8 @@ tape( 'the function evaluates the complementary error function for `x` on the in
225
225
226
226
tape ( 'the function evaluates the complementary error function for `x` on the interval `[0.8,1]`' , opts , function test ( t ) {
227
227
var expected ;
228
+ var delta ;
229
+ var tol ;
228
230
var x ;
229
231
var y ;
230
232
var i ;
@@ -233,13 +235,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
233
235
x = smallPositive . x ;
234
236
for ( i = 0 ; i < x . length ; i ++ ) {
235
237
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
+ }
237
245
}
238
246
t . end ( ) ;
239
247
} ) ;
240
248
241
249
tape ( 'the function evaluates the complementary error function for `x` on the interval `[-0.8,0.8]`' , opts , function test ( t ) {
242
250
var expected ;
251
+ var delta ;
252
+ var tol ;
243
253
var x ;
244
254
var y ;
245
255
var i ;
@@ -248,13 +258,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
248
258
x = smaller . x ;
249
259
for ( i = 0 ; i < x . length ; i ++ ) {
250
260
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
+ }
252
268
}
253
269
t . end ( ) ;
254
270
} ) ;
255
271
256
272
tape ( 'the function evaluates the complementary error function for `x` on the interval `[-1e-300,-1e-308]`' , opts , function test ( t ) {
257
273
var expected ;
274
+ var delta ;
275
+ var tol ;
258
276
var x ;
259
277
var y ;
260
278
var i ;
@@ -263,13 +281,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
263
281
x = tinyNegative . x ;
264
282
for ( i = 0 ; i < x . length ; i ++ ) {
265
283
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
+ }
267
291
}
268
292
t . end ( ) ;
269
293
} ) ;
270
294
271
295
tape ( 'the function evaluates the complementary error function for `x` on the interval `[1e-300,1e-308]`' , opts , function test ( t ) {
272
296
var expected ;
297
+ var delta ;
298
+ var tol ;
273
299
var x ;
274
300
var y ;
275
301
var i ;
@@ -278,13 +304,21 @@ tape( 'the function evaluates the complementary error function for `x` on the in
278
304
x = tinyPositive . x ;
279
305
for ( i = 0 ; i < x . length ; i ++ ) {
280
306
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
+ }
282
314
}
283
315
t . end ( ) ;
284
316
} ) ;
285
317
286
318
tape ( 'the function evaluates the complementary error function for subnormal `x`' , opts , function test ( t ) {
287
319
var expected ;
320
+ var delta ;
321
+ var tol ;
288
322
var x ;
289
323
var y ;
290
324
var i ;
@@ -293,7 +327,13 @@ tape( 'the function evaluates the complementary error function for subnormal `x`
293
327
x = subnormal . x ;
294
328
for ( i = 0 ; i < x . length ; i ++ ) {
295
329
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
+ }
297
337
}
298
338
t . end ( ) ;
299
339
} ) ;
0 commit comments