[LCP]Rounding questions

Chuck Martin nrocinu at myrealbox.com
Fri Sep 6 05:16:05 UTC 2002


On Thu, Sep 05, 2002 at 12:36:39PM -0500, Steve Baker wrote:
>   It seems perplexing, but the problem is that round is not prototyped in
> math.h, or anywhere for that matter.  This is clearly a glibc maintainer
> issue.  Add to your program at the top:
> 
> double round(double);

Thank you!  This works.  Do you happen to know why rint() works without
doing this?  I can't seem to find a prototype for it anywhere, including
math.h.

>   This is a good reminder of why you have to prototype your functions!

Yes, but I never expected to have to prototype a function in a standard
library.

Now this brings me to the other question I asked when I started this
thread.  How portable is this?  The man page says it conforms to C99,
but I'm not up on all of the standards and where they're all used.
Will using this instead of my own rounding routine cause problems in
portability, and if so, to what extent?

Chuck





More information about the linuxCprogramming mailing list