Using single-precision for faster calculation

Just adding a different view point, depending on the problem and your algorithm it can be beneficial to run at higher precision. In fact I run code that uses quad precision in places because its overall faster than running in single or double precision!

This happens when we are integrating a set of very stiff equations, so we are adding very big and very small numbers. With double precision there is round off error and results can depend on the order we add terms up. Thus our integrator ends up having to take many small steps. While with quad precision each step is more expensive but we take alot less steps.

Overall we get ~10x speed up by using quad precision (which fortran makes easy by just changing the kind parameter, instead of the other techniques to reduce round error like Kahan summation or pre-sorting the data).

4 Likes