Mail Archives: djgpp-workers/2003/08/14/02:43:10
Hello.
Esa A E Peuha wrote:
>
> On Tue, 12 Aug 2003 Kbwms AT aol DOT com wrote:
>
> > In a message dated 8/12/2003 3:17:57 AM Eastern Standard Time,
> > eliz AT elta DOT co DOT il writes:
> >
> > > Deduction, perhaps mistaken: after the first iteration thru this
> > > loop:
> > >
> > > for (; integer &&p >= startp; ++expcnt)
> > > {
> > > tmp = modfl(integer * 0.1L , &integer);
> > > *p-- = tochar((int)((tmp + .01L) * 10));
> > > }
> > >
> > > the value of `integer' had a .375 as its fraction.
> >
> > A mistake is in multiplying by 0.1 instead of dividing by 10 and taking
> > the remainder.
>
> I agree. This should definitely divide by ten to produce as accurate
> result as possible. Multiplying by 0.1 will cause errors when the
> number has large absolute value. Could someone test the following patch
> before I commit it?
[snip]
FWIW the patch makes no difference to the result of the Cygnus test suite for
me. If anyone's interested, I've put the results here:
http://www.phekda.freeserve.co.uk/richdawe/djgpp/2.04/
And K. B. Williams's test program (the one that displays "Begin with Rounding
Mode at Startup") shows the same results, when compiled with a patched libc.
I used an Athlon 850MHz, gcc 3.2.1, binutils 2.13, Windows '98 SE.
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -