[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Float problems with trunc() and round()
From: |
Justin Guyett |
Subject: |
Re: Float problems with trunc() and round() |
Date: |
Wed, 3 Oct 2001 13:08:14 -0700 (PDT) |
On 3 Oct 2001, Andreas Schwab wrote:
> Kjeld Borch Egevang <address@hidden> writes:
>
>> I suppose the functions trunc() and round() should do something
>> similar to ceil() and floor(). When I try this on my i686-linux, it
>> seems to be broken. Here is my test:
>
> Your test is broken.
(glibc 2.2.4, i686-pc-linux-gnu, 2.4.9-ac3, gcc 2.95.3)
---CUT---
#include <stdio.h>
#include <math.h>
int main(int argc, char **argv)
{
printf("%f %f\n", truncf(1000.250), roundf(1000.501));
return(0);
}
---CUT---
% gcc -o t1 -lm test.c
% ./t1
0.000000 2.086854
looks broken to me, but maybe i'm forgetting something
justin
- Float problems with trunc() and round(), Kjeld Borch Egevang, 2001/10/03
- Re: Float problems with trunc() and round(), Andreas Schwab, 2001/10/03
- Re: Float problems with trunc() and round(),
Justin Guyett <=
- Re: Float problems with trunc() and round(), Andreas Schwab, 2001/10/03
- Re: Float problems with trunc() and round(), Kjeld Borch Egevang, 2001/10/03
- Re: Float problems with trunc() and round(), Justin Guyett, 2001/10/03
- Re: Float problems with trunc() and round(), Andreas Schwab, 2001/10/04
- Re: Float problems with trunc() and round(), Kjeld Borch Egevang, 2001/10/04