This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The round() function outputs random numbers #include <math.h> main() { printf( "%f %f\n", round(1.0), round(1.0001)); } Output -2.000000 6.000000 However these values appear to be random, and can change on different machines and at different times on the same machine. (Mandrake 9.0 and 9.1) gcc -o test test.c -lm
Use warnings: pr13734.c:4: warning: return type defaults to `int' pr13734.c: In function `main': pr13734.c:5: warning: implicit declaration of function `round' pr13734.c:5: warning: double format, different type arg (arg 2) pr13734.c:5: warning: double format, different type arg (arg 3) pr13734.c:6: warning: control reaches end of non-void function See how round is implicitly declared, use -std=c99 or -std=gnu99 which turns on the c99 functions in math.h.