Skip to content

Commit c0b83dd

Browse files
committed
Fix bugs in stopping condition of Newton iteration
1 parent f8677a0 commit c0b83dd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

pineappl/src/interpolation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod applgrid {
2222
for _ in 0..10 {
2323
let x = (-yp).exp();
2424
let delta = (1.0 - x).mul_add(-5.0, y - yp);
25-
if (delta.abs() < 1e-15) && (delta >= deltap) {
25+
if (delta == 0.0) || ((delta.abs() < 2e-15) && (delta.abs() >= deltap.abs())) {
2626
return x;
2727
}
2828
let deriv = x.mul_add(-5.0, -1.0);

pineappl/tests/drell_yan_lo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn perform_grid_tests(
363363
let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]);
364364

365365
for (result, reference) in bins.iter().zip(reference.iter()) {
366-
assert_approx_eq!(f64, *result, *reference, ulps = 4);
366+
assert_approx_eq!(f64, *result, *reference, ulps = 8);
367367
}
368368

369369
// TEST 5b: `convolve` with `ConvolutionCache::with_two`
@@ -397,8 +397,8 @@ fn perform_grid_tests(
397397

398398
for (&node_value1, &node_value2, &ref_value) in izip!(&node_values[1], &node_values[2], x_grid)
399399
{
400-
assert_approx_eq!(f64, node_value1, ref_value, ulps = 4);
401-
assert_approx_eq!(f64, node_value2, ref_value, ulps = 4);
400+
assert_approx_eq!(f64, node_value1, ref_value, ulps = 8);
401+
assert_approx_eq!(f64, node_value2, ref_value, ulps = 8);
402402
}
403403

404404
let bins = grid.convolve(&mut convolution_cache, &[], &[], &[], &[(1.0, 1.0, 1.0)]);

0 commit comments

Comments
 (0)