[LCP]Rounding questions
Andrew Weaver
Andrew.Weaver at tecnomen.fi
Thu Sep 5 20:21:27 UTC 2002
I used also floor and ceil and rint and got:
round = 2.678909
rint = 390.000000
floor = 390.000000
ceil = 390.000000
Still cannot find a man entry on "round" though so not sur what it means.
On Thursday, September 05, 2002 12:46 PM, Chuck Martin
[SMTP:nrocinu at myrealbox.com] wrote:
> On Thu, Sep 05, 2002 at 10:12:55AM +0100, Vincent Penquerc'h wrote:
> > You've linked libm.a in, did you (-lm) ?
>
> Thanks. How did I miss the obvious? The results are still strange:
>
> chuck at zeta:~$ cat roundtest.c
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> printf("%f\n", round((double) 390.0));
> }
> chuck at zeta:~$ gcc -lm -o roundtest roundtest.c
> chuck at zeta:~$ ./roundtest
> 2.896811
> chuck at zeta:~$
>
> Why is it rounding 390.0 and getting 2.896811?
>
> Chuck
>
>
> _______________________________________________
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
More information about the linuxCprogramming
mailing list