I\'m getting unexpected results from the round()
and roundf()
functions in the math.h
library. Here is the sample code:
#
One more "works on my machine" on Ubuntu with gcc version 4.3.2.
$ ./a.out
1.000000
1.000000
I do get a couple of warnings when I compile, though.
$ gcc -lm round.c
round.c: In function ‘main’:
round.c:11: warning: incompatible implicit declaration of built-in function ‘roundf’
round.c:12: warning: incompatible implicit declaration of built-in function ‘round’