Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Created January 29, 2015 18:32
Show Gist options
  • Save simonbyrne/d2c84417dd831dfea8fb to your computer and use it in GitHub Desktop.
Save simonbyrne/d2c84417dd831dfea8fb to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int main() {
volatile double a = 0.1;
volatile double x = a + 0.2;
printf("%.20f\n", x);
volatile double y = fma(a, 1.0, 0.0);
printf("%.20f\n", y);
volatile double z = y + 0.2;
printf("%.20f\n", z);
return 0;
}
@simonbyrne
Copy link
Author

Compiled with gcc fmatest.c -o fmatest -lm, on GCC 4.8.2, gives:

0.30000000000000004441
0.10000000000000000555
0.30000000000000004441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment