round() in glibc*2.3.3-31

Matias Feliciano feliciano.matias at free.fr
Sun May 30 08:47:39 UTC 2004


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 !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e=2E?=
Url : http://lists.fedoraproject.org/pipermail/test/attachments/20040530/44d6e1b3/attachment.bin 


More information about the test mailing list