[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: round function
From: |
Petr Vandrovec |
Subject: |
Re: round function |
Date: |
Thu, 7 Mar 2002 21:32:07 +0100 |
On 7 Mar 02 at 16:48, Ricardo Fabbri wrote:
> /*---------------------------------*/
> #include<math.h>
> #include<stdio.h>
>
> main()
> {
> printf("%f\n",round(4.5));
> return 0;
> }
> /*---------------------------------*/
>
> bash$ gcc -o tmp tmp.c -lm
You should use 'gcc -W -Wall -o tmp tmp.c -lm'. It will quickly reveal
that your code is a bit suboptimal. If you'll compile it with
'gcc -W -Wall -D_ISOC99_SOURCE -o tmp tmp.c -lm', it will work correctly.
round() prototype is available from math.h only if C99 (or GNU_SOURCE)
is defined.
Best regards,
Petr Vandrovec
address@hidden
- round function, Ricardo Fabbri, 2002/03/07
- Re: round function,
Petr Vandrovec <=