FMA function: hand-coded vs std::fma

Looking at prim/scal/fun/fma.hpp, there’s this comment:

Warning: This does not delegate to the high-precision platform-specific fma() implementation.

Was there a speed/precision concern behind this or is it more of a TODO?

We talked about this on the Math meeting today and no one had a definitive answer to this.
Its possible that fma() wasnt used as it only became part of in C++11 and the one in math.h did not support mixed argument types. That would be the best guess.

Thanks for bringing that up! I’m just working on a PR at the moment to replace hand-coded math with c++11-introduced functions, so that’s very helpful

Right. No reason not to delegate to fma() where possible.

Thanks both, I’ll move ahead with replacing it

1 Like