▲ | wiz21c 6 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... | ||||||||
▲ | zokier 6 days ago | parent [-] | |||||||
herbie recommends `fma(h, (i + 0.5), a)`, but also doesn't report any accuracy problems with the original either | ||||||||
|