3 ms·
This seems to be a flawed approach. Comparing the result to sub/div is not computing the error in the fused-mac. It is calculating the difference between one ro
by 314 5y ago
This seems to be a flawed approach. Comparing the result to sub/div is not computing the error in the fused-mac. It is calculating the difference between one rounding operation and two.
To do this correctly requires:
* performing the calculation with a higher degree of accuracy (and precision).
* comparing the two approaches against the reference results.
To do this you should look into either writing a simulation of ieee with a larger mantissa or using an arbitrary precision library.
- davrosthedalek 5y agoI think you can model the process as a random walk, and I'd expect 2 roundings/iteration to stray away from the true value about sqrt(2) more. But it seems that the fused iteration is actually worse than the manual one. Could be this is because of the reverse operation and inter-iteration dependencies.
- marcan_42 5y agoYes, this is obviously a broken test. It isn't computing the error, it's computing the difference with another operation with its own error.
- brandmeyer 5y agoMPFR would work as a reference library for the comparison.
- deleted 5y ago[deleted]
- jcranmer 5y agoI wrote a quick-and-dirty test using a simple dot product as the basis for testing precision. (Dot product-like operations are a relatively common use case for FMA). Which result is more precise depends on the input data (I randomized it), but it seems that most commonly, there was no actual difference using FMA and not using it, and when there was a difference, it was even odds which one was the more precise result.