Mail Archives: djgpp-workers/2003/08/14/04:32:25
> Date: Thu, 14 Aug 2003 07:34:54 +0100
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
>
> Esa A E Peuha wrote:
> > >
> > > 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.
As I'd expect, FWIW: the problem seems to be that the result of either
multiplying by 0.1 or dividing by 10 does not have an exact FP
representation. That is, we are seeing inaccuracies in the last
significant digit which are to be expected.
I don't know how to fix this without a radical change in the
algorithm.
Btw, the code we have in _doprnt was originally taken from the BSD
libc, IIRC. So if someone has access to FreeBSD, it'd be interesting
to see if they exibit the same problem with K.B.'s test program.
- Raw text -