From: Kbwms AT aol DOT com Message-ID: <50.20b0edc5.2c67d494@aol.com> Date: Sun, 10 Aug 2003 13:02:12 EDT Subject: Anomaly in printf() To: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part1_50.20b0edc5.2c67d494_boundary" X-Mailer: 8.0 for Windows sub 6011 Reply-To: djgpp-workers AT delorie DOT com --part1_50.20b0edc5.2c67d494_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit The following program: #include int main(void) { long double Demo = (unsigned long long)(-1); printf("Demo = %.0Lf\n", Demo); printf("Demo - 1 = %.0Lf\n", Demo-1.0L); exit(0); } produces the following (erroneous second line of) output: Demo = 18446744073709551615 Demo - 1 = 18446744073709551613 Is this a known problem? --part1_50.20b0edc5.2c67d494_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable The following program:

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

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

produces the following (erroneous second line of) output:

Demo       =3D 18446744073709551615
Demo - 1 =3D 18446744073709551613


Is this a known problem?
--part1_50.20b0edc5.2c67d494_boundary--