This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: GCC error ?


On Friday 07 June 2002 00:40, Hans-Joachim.Schmidt@bmf.bund.de wrote:
> Hello,
>
> there is a problem when I compute:
>
>    double x,y,d,e;
>
>    x=112.7;
>    y=120.0;
>
>    d=x/y-1;
>    e=x/y;  e--;
>
>    d=0x1.70a3d70a3d711p-6    (output of %a format)
>    e=0x1.70a3d70a3d700p-6
>
>    and
>    d-e=0x1.1000000000000p-54
>
>
> Does the output of 'd' and 'e' (in %a format) show that there is more than
> 1 bit difference ?
>
> We use SuSE Linux 8.0 (i386) - Kernel 2.4.18-64GB-SMP on a Pentium III
> (Coppermine).
>
>
It looks as if the division in the first expression has been rounded only to 
64-bit precision, while the value of e has been rounded again to 53-bit 
precision before being decremented.  This would be an expected behavior, in 
the absence of any instructions by you to the contrary.  There was a thread 
on this earlier this week, how the choice of precision mode mode is the 
responsibility of the library, not gcc.

-- 
Tim Prince


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