Mail Archives: djgpp-workers/2003/08/10/14:05:32
--part1_1e0.eca6e87.2c67e363_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
In a message dated 8/10/2003 1:50:20 PM Eastern Standard Time, dj AT delorie DOT com
writes:
> >produces the following (erroneous second line of) output:
> >
> >Demo = 18446744073709551615
> >Demo - 1 = 18446744073709551613
> >
> >
> >Is this a known problem?
>
> I've not heard of it. What happens when you use .3 instead of .0 in
> that format spec?
>
Behold:
#include <stdio.h>
int
main(void)
{
long double Demo = (unsigned long long)(-1);
printf("Demo = %.3Lf\n", Demo);
printf("Demo - 1 = %.3Lf\n", Demo-1.0L);
exit(0);
}
Demo = 18446744073709551615.000
Demo - 1 = 18446744073709551613.000
--part1_1e0.eca6e87.2c67e363_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">In a message dated 8/10/2003 1:50:20 PM Eastern Standard=
Time, dj AT delorie DOT com writes:<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT COLOR=3D"#000000"=
style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"A=
rial" LANG=3D"0">>produces the following (erroneous second line of) outpu=
t:<BR>
><BR>
>Demo =3D 18446744073709551615<BR>
>Demo - 1 =3D 18446744073709551613<BR>
><BR>
><BR>
>Is this a known problem?<BR>
<BR>
I've not heard of it. What happens when you use .3 instead of .0 in<BR=
>
that format spec?<BR>
</BLOCKQUOTE><BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">Behold:<BR>
<BR>
#include <stdio.h><BR>
int<BR>
main(void)<BR>
{<BR>
long double Demo =3D (unsigned long long)(-1);<BR>
<BR>
printf("Demo =3D %.3L=
f\n", Demo);<BR>
printf("Demo - 1 =3D %.3Lf\n", Demo-1.0L);<BR>
exit(0);<BR>
}<BR>
Demo =3D 18446744073709551615.000<BR>
Demo - 1 =3D 18446744073709551613.000<BR>
</FONT></HTML>
--part1_1e0.eca6e87.2c67e363_boundary--
- Raw text -