delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/14/02:43:10

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3F3B2D8E.F90E84B5@phekda.freeserve.co.uk>
Date: Thu, 14 Aug 2003 07:34:54 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Anomaly in printf()
References: <46 DOT 3c4de930 DOT 2c6a2e90 AT aol DOT com> <Pine DOT OSF DOT 4 DOT 51 DOT 0308131046310 DOT 2694 AT sirppi DOT helsinki DOT fi>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019