X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3F5E2712.9E8C2E1F@phekda.freeserve.co.uk> Date: Tue, 09 Sep 2003 20:16:34 +0100 From: Richard Dawe 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, peuha AT cc DOT helsinki DOT fi Subject: Re: Anomaly in printf() References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Kbwms AT aol DOT com wrote: > Esa Peuha, student of mathematics at the University of Helsinki: You might be wondering what K. B. Williams is talking about. Esa: I sent him the patch you made to _doprnt to fix the problems in the accuracy of its output. It looks like it worked. ;) Bye, Rich =] > Nice going, as the examples below show: > > #include > 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 -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]