Hey,

Anyone that understands FP better than I do:In the above code, you are multiplying the step by an integer -- is there any precision loss when you do that??

Elementary operations (add, sub, mul, div) are demanded to be correctly rounded (cr) by IEEE, i.e. accurate within +/- 0.5 ulp. Consequently, a cr multiplication followed by a cr addition will be accurate within +/-1 ulp. This is also true if the first multiplicand is an integer.

Using FMA will reduce this to +/- 0.5 ulp. This increase in accuracy of the grid calculation should not be relevant - but it also does not hurt.

Still I would suggest adding the FMA operation to numpy, e.g. np.fma(a, b, c). There are several places in numpy that could benefit from the increased accuracy, e.g. evaluation of polynomials using Horner's method. In cases like this due to iteration and consequent error propagation the accuracy benefit of using FMA can be far larger. There may also be a performance benefit on platforms that implement FMA in hardware (although I am not sure about that).

Cheers

Nils