3 ms·
Note that not all languages semantically allow combining a+b*c into fma. This isn't a floating point problem, but a language problem.
by adgjlsfhk1 4y ago
Note that not all languages semantically allow combining a+b*c into fma. This isn't a floating point problem, but a language problem.
- tsimionescu 4y agoIf you're doing long FP calculations, you can allow FMA, or have poor results. Sure, some languages think it's worth it for the determinism, but rounding after every operation can completely destroy your precision. Even more so for something like x87, where internal registers are higher precision, not that too many people use it anymore.
- adgjlsfhk1 4y agoThere's a 3rd option. Allow fma, but only where the programmer explicitly puts an `fma` (or specifically allows reordering). This does sacrifice a little bit of ease of use to get optimal performance, but allows for reproducibility and high performance. It is a shame x87 was so poorly thought out. If it had a better defined programming model, it would be incredibly useful.