Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!ulysses!andante!alice!andrew From: andrew@alice.UUCP (Andrew Hume) Newsgroups: comp.lang.c Subject: Re: Source for ASCII to FLOAT Summary: does someone have the real answer? Keywords: atof( ) ASCII float Message-ID: <9699@alice.UUCP> Date: 29 Jul 89 04:02:15 GMT References: <38@pldote.intel.com> <8207@xyzzy.UUCP> Distribution: usa Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 17 it seems to me the discussion of an atof is going in th wrong direction. it is nice to insist that 1.0 and 0.1e1 evaluate to the same bit pattern but really what we want, at least what i want, is an accurate atof. if you consider the real number line, the set of possible values of double (or whatever precision) are just a bunch of points on this line. then atof should return the closest such point to the real represented by the string. (ties should probably be broken systematically.) in summary, get someone who really knows what is going on (not me certainly) to figure it out; buggering around with half-hearted hacks to preserve some precious bits of accuracy is simply a waste of time, however well intentioned. (sorry, my spleen needed venting.)