Path: utzoo!attcan!uunet!mcsun!ukc!slxsys!ibmpcug!dylan From: dylan@ibmpcug.co.uk (Matthew Farwell) Newsgroups: comp.lang.c Subject: Re: Inherent imprecision of floating point variables Message-ID: Date: 27 Jun 90 14:16:46 GMT References: <3300@crash.cts.com> <44436@ism780c.isc.com> Reply-To: dylan@ibmpcug.CO.UK (Matthew Farwell) Organization: The IBM PC User Group, UK. Lines: 31 In article <44436@ism780c.isc.com> marv@ism780.UUCP (Marvin Rubenstein) writes: >The problem has nothing to do with C or the precision of the machine's >floating point unit. It has to do with the precision of the ASCII to float >and float to ASCII conversion routines. This problem was addressed at the >SIGPLAN '90 conference on Program Language Design and Implementation. Two >papers appear in the proceedings: Consider the code segment:- main() { float f; f = 0.0; while (1) { if (f == 10.0) break; printf("%f\n", f); f += 0.1; } printf("Stopped\n"); } If its all to do with conversion routines, why doesn't this stop when f reaches 10? Dylan. -- Matthew J Farwell | Email: dylan@ibmpcug.co.uk The IBM PC User Group, PO Box 360,| dylan%ibmpcug.CO.UK@ukc Harrow HA1 4LQ England | ...!uunet!ukc!ibmpcug.co.uk!dylan Phone: +44 81-863-1191 | Sun? Don't they make coffee machines?