The correctness of fma() function can be verified using the following program:
---------------------------------------------------
#include <stdio.h>
#include <math.h>

volatile double x = 0x1.0000000000003p52;
volatile double y = 0x1.0000000000005p52;
volatile double z = -0x1.0000000000008p104;

int main(){
        printf("x * y + z    = %f\n", x * y + z);
        printf("fma(x, y, z) = %f\n", fma(x, y, z));
}
---------------------------------------------------
A naive multiply-then-add loses some LSBs during the multiplication and
yields zero when the MSBs are complemented by a negative number.
A true FMA function yields 15 in this example.


------------------                               
Best regards,
lh_mouse
2017-01-18


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to