This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Rounding Error
- To: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Subject: Re: Rounding Error
- From: Eric Mercer <eemercer at yuan dot elen dot utah dot edu>
- Date: Thu, 17 Sep 1998 13:47:07 -0600 (MDT)
- cc: egcs-bugs at cygnus dot com
> It's just rounding error.
Normally I would agree, but there are a few things that make this weird:
1) The floor and ceil return the same value, meaning that the
result is already a double with no fractional portion,
otherwise floor and ceil would have been different.
2) If you use a constant for the value tolerance, the correct
answer is obtained.
3) If you type cast the floor or ceil of the value to an integer,
the correct answer is obtained, even though the bit pattern
of the value is identical before and after the call to floor
or ceil.
4) If you assign the result to a temporary double and then typecast
the temporary double, you get the correct answer.
5) Other machine architectures ( not Intel ) execute the code
correctly.
egm