delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/12/03:16:09

Date: Tue, 12 Aug 2003 09:07:35 +0200
From: "Eli Zaretskii" <eliz AT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-Id: <5567-Tue12Aug2003090735+0300-eliz@elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
In-reply-to: <200308111805.h7BI5ajW000660@envy.delorie.com> (message from DJ
Delorie on Mon, 11 Aug 2003 14:05:36 -0400)
Subject: Re: Anomaly in printf()
References: <1e0 DOT eca6e87 DOT 2c67e363 AT aol DOT com> <200308101817 DOT h7AIHDhr019129 AT envy DOT delorie DOT com> <9003-Sun10Aug2003222306+0300-eliz AT elta DOT co DOT il> <200308102312 DOT h7ANC6mQ021365 AT envy DOT delorie DOT com> <uu18osptc DOT fsf AT elta DOT co DOT il> <200308111328 DOT h7BDS5un031026 AT envy DOT delorie DOT com> <9003-Mon11Aug2003194545+0300-eliz AT elta DOT co DOT il> <200308111805 DOT h7BI5ajW000660 AT envy DOT delorie DOT com>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Mon, 11 Aug 2003 14:05:36 -0400
> From: DJ Delorie <dj AT delorie DOT com>
> 
> >   . The closest long double to (unsigned long long)(-1) is
> >     18446744073709551613.75;
> 
> How did you come up with this number?

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.

[As I wrote in my other mail today, "(unsigned long long)(-1)" should
have been "(unsigned long long)(-1) - 1".]

- Raw text -


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