5 ms·
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 rea
by wiz21c 2y 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...