Re: round not in math.h?

Wolfgang Jansen <[email protected]> Mon, 19 Sep 2005 10:13:21 +0200
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Organization University of Potsdam, Institute of Informatics
Message-ID <[email protected]>
[email protected] wrote:

>
>Now, as it is C99 dependant, it looks a bit hard to write
>portable code using "round". What to do? Use some trick as
>you proposed? Just defining the prototype for round function
>(as it is in  lib math)? This works on some systems but
>probably not all.
>
>Any other idea?
>
>Philippe Ribet
>
>  
>
Hello,
I think `round' is quite meaningless in C, simply use
double->int conversion instead:
  double d;
  int n;
  n = d;
  /* if you want a double result as for `round': */
  x = n;

Wolfgang Jansen

>Hello,
>
>according to "man round", round function is declared in
>math.h. But while including math.h the C compiler stills
>complain about undefined function. Moreover, I can't find
>"round" in math.h
>
>Does anyone know something about this problem?
>
>Thanks,
>
>Philippe Ribet
>  
>