[LCP]Rounding questions
Chuck Martin
nrocinu at myrealbox.com
Thu Sep 5 19:56:06 UTC 2002
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
More information about the linuxCprogramming
mailing list