bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Float problems with trunc() and round()


From: Andreas Schwab
Subject: Re: Float problems with trunc() and round()
Date: 03 Oct 2001 18:11:47 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.107

Kjeld Borch Egevang <address@hidden> writes:

|> I discovered what I assume to be a problem.
|> 
|> I suppose the functions trunc() and round() should do something similar to
|> ceil() and floor().
|> 
|> When I try this on my i686-linux, it seems to be broken. Here is my test:

Your test is broken.

|> #include <math.h>
|> 
|> int main()
|> {
|>     float x;
|> 
|>     x = 4.0/3;
|>     printf("%e %e %e %e %e\n", x, floor(x), ceil(x), trunc(x), round(x));
|> }

gcc -O2 -g -Wall     round.c  -lm -o round
round.c: In function `main':
round.c:8: warning: implicit declaration of function `printf'
round.c:8: warning: implicit declaration of function `trunc'
round.c:8: warning: implicit declaration of function `round'
round.c:8: warning: double format, different type arg (arg 5)
round.c:8: warning: double format, different type arg (arg 6)
round.c:9: warning: control reaches end of non-void function

Andreas.

-- 
Andreas Schwab                                  "And now for something
address@hidden                          completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]