delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/09/09/12:00:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Kbwms AT aol DOT com
Message-ID: <a.354a4585.2c8f52cf@aol.com>
Date: Tue, 9 Sep 2003 11:59:11 EDT
Subject: Re: Anomaly in printf()
To: peuha AT cc DOT helsinki DOT fi, djgpp-workers AT delorie DOT com
MIME-Version: 1.0
X-Mailer: 8.0 for Windows sub 6015
Reply-To: djgpp-workers AT delorie DOT com

--part1_a.354a4585.2c8f52cf_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Esa Peuha, student of mathematics at the University of Helsinki:

Nice going, as the examples below show:


#include <stdio.h>
int
main(void)
{
    long double    Demo = (unsigned long long)(-1);

    printf("Demo     = %.0Lf\n", Demo);
    printf("Demo - 1 = %.0Lf\n", Demo-1.0L);
    printf("Demo - 2 = %.0Lf\n", Demo-2.0L);
    exit(0);
}



Current _doprnt.o:

Demo     = 18446744073709551615
Demo - 1 = 18446744073709551613
Demo - 2 = 18446744073709551613

Improved _doprnt.o:

Demo     = 18446744073709551615
Demo - 1 = 18446744073709551614
Demo - 2 = 18446744073709551613


KB Williams

--part1_a.354a4585.2c8f52cf_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<HTML><FONT FACE=3Darial,helvetica><FONT  SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"=
Georgia" LANG=3D"0">Esa Peuha, student of mathematics at the University of H=
elsinki:<BR>
<BR>
Nice going, as the examples below show:<BR>
<BR>
<BR>
#include &lt;stdio.h&gt;<BR>
int<BR>
main(void)<BR>
{<BR>
&nbsp;&nbsp;&nbsp; long double&nbsp;&nbsp;&nbsp; Demo =3D (unsigned long lon=
g)(-1);<BR>
<BR>
&nbsp;&nbsp;&nbsp; printf("Demo&nbsp;&nbsp;&nbsp;&nbsp; =3D %.0Lf\n", Demo);=
<BR>
&nbsp;&nbsp;&nbsp; printf("Demo - 1 =3D %.0Lf\n", Demo-1.0L);<BR>
&nbsp;&nbsp;&nbsp; printf("Demo - 2 =3D %.0Lf\n", Demo-2.0L);<BR>
&nbsp;&nbsp;&nbsp; exit(0);<BR>
}<BR>
<BR>
<BR>
<BR>
Current _doprnt.o:<BR>
<BR>
Demo&nbsp;&nbsp;&nbsp;&nbsp; =3D 18446744073709551615<BR>
Demo - 1 =3D 18446744073709551613<BR>
Demo - 2 =3D 18446744073709551613<BR>
<BR>
Improved _doprnt.o:<BR>
<BR>
Demo&nbsp;&nbsp;&nbsp;&nbsp; =3D 18446744073709551615<BR>
Demo - 1 =3D 18446744073709551614<BR>
Demo - 2 =3D 18446744073709551613<BR>
<BR>
<BR>
KB Williams</FONT></HTML>

--part1_a.354a4585.2c8f52cf_boundary--

- Raw text -


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