No. In fact, the main part of the advantage of smooth multiplication-addition is that it (necessarily) does not give the same result as a separate multiply and add.
As an (somewhat far-fetched) example, suppose we have:
double a = 1 + 0x1.0p-52
and we want to calculate a*b - 1 . The "mathematically accurate" value of a*b - 1 :
(1 + 2**-52)(1 - 2**-52) - 1 = 1 + 2**-52 - 2**52 - 2**-104 - 1 = -2**-104
but if we first calculate a*b using multiplication, round to 1.0, so a subsequent subtraction of 1.0 will result in a result of zero.
If we use fma(a,b,-1) instead, we eliminate the intermediate rounding of the work, which allows us to get a βrealβ answer of -1.0p-104 .
Please note that we not only get a different result, but also other flags; separate multiplication and subtraction sets an inaccurate flag, while compiled multiple additions do not set any flags.
source share