Comment by wiz21c
4 days ago
In the rectangle method, there is "let x = a + i * h + (h / F1::from(2)...)"
I didn't check, but I wonder if it is not better to do x = a + (i+0.5)*h... My reasoning is that if "i" is very big, then i * h can be much bigger than h/2 and thus h/2 may be eaten by numerical precision when added to i*h... And then you have to convince the optimizer to do it the way you want. But well, it's late...
herbie recommends `fma(h, (i + 0.5), a)`, but also doesn't report any accuracy problems with the original either
yeah, fused mul-add is certainly better. Dunno how one epxresses that in rust though :-) Ahhh seems like there at least f64::mul_add() in stdlib :-)