3 gcc -g -O2 fp-valgrind-test.c -o fp-valgrind-test
5 valgrind ./fp-valgrind-test
6 gdb -q --args ./fp-valgrind-test
17 case 0: return -322.500001; break;
18 case 1: return -322.5; break;
19 case 2: return -322.499999; break;
20 case 3: return 322.499999; break;
21 case 4: return 322.5; break;
22 default: return 322.500001; break;
28 for (int i
= 0; i
< 6; i
++) {
29 volatile double a
= value(i
);
30 int b
= (int)round(a
);
31 printf("i=%d a=%f a=0x%llx b=%d\n", i
, a
, *(long long unsigned int*)&a
, b
);