Le dim 30/05/2004 à 07:24, Mark Fonnemann a écrit :
(snip)
round returning
junk data which i still maintain is something gcc should fix
I am not a very "competent" programmer but there is nothing wrong with
gcc or glibc.
Without prototype, round() is supposed to return an int and not a double
(as describe in K&R manual :-)).
The bug report you pointed is clear :
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13734
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'
math.h :
The file <bits/mathcalls.h> contains the prototypes for all the
actual math functions.
bits/mathcalls.h :
#ifdef __USE_ISOC99
[...]
/* Round X to nearest integral value, rounding halfway cases away from
zero. */
__MATHCALLX (round,, (_Mdouble_ __x), (__const__));
gcc have very useful warnings for competent and incompetent programmers.
Use -Wall for exemple (info gcc).
i challenge you to a coding contest if you really feel the urge to
prove yourself!
http://people.redhat.com/drepper/
Have fun !