This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Rounding Error



> 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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]