[Top][All Lists]

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

question about GCC

From: Matt Salganik
Subject: question about GCC
Date: Wed, 25 Jun 2003 11:16:25 -0400


I was writing some code in C to perform numerical calculations and in my program I tried to use round(). The program compiled but the round() function produced extremely strange results. I looked at the man page and this offered me no hint as to why round() would act so strangely.

Later I asked a more experienced colleague. After about one hour of investigation he explained to me that round() is not actually declared in <math.h> even though looking at the man page one might think it is. He also explained that this has something to do with the C99 standard (something I have never heard of). The problem was that the compiler assumed round() would return an int, but it actually returned a float. This caused lots of problems.

In any case, I was writing to tell you about this problem, which you may already know about, and to suggest that either you declare round() in <math.h> or explain the situation more fully in the man page.

Thanks for all your work in developing and maintaining GCC. I use it all the time.


Matt Salganik

reply via email to

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