From ... From: Erik Naggum Subject: Re: parse-float trial implementation (was Re: String to real) Date: 2000/06/09 Message-ID: <3169560072007578@naggum.no>#1/1 X-Deja-AN: 633116254 Content-Transfer-Encoding: 8bit References: <393FDD06.ED9BCA0C@nexo.es> <3169487578816052@naggum.no> <868zwfmkqp.fsf_-_@coulee.tdb.com> <3169554427524862@naggum.no> <86vgzilrbg.fsf@coulee.tdb.com> mail-copies-to: never Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 960571277 3540 195.0.192.66 (9 Jun 2000 17:21:17 GMT) Organization: Naggum Software; vox: +47 8800 8879; fax: +47 8800 8601; http://www.naggum.no User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.6 Mime-Version: 1.0 NNTP-Posting-Date: 9 Jun 2000 17:21:17 GMT Newsgroups: comp.lang.lisp * Russell Senior | It would be interesting and educational for me if you could point a | few of them out. Given the `slew' it should not be difficult. The last sentence is completely bogus, and obviously so. Finding which of 2^64 bit patterns are read and printed wrong is no small task, even if there are 2^16 of them. I spent a few hundred CPU hours on 2 × 600MHz Pentium III's and 2 × 400MHz Pentium II's stress-testing Allegro CL's floating-point reader and printer and came up with a few interesting cases where it missed, due to accumulated rounding errors. It dook Duane Rettig of Franz Inc several days to come up with a solution, and it was not trivial, neither in terms of the code required or the time required to read or print floating-point numbers correctly. C's atof and printf were never meant to be print-read-consistent, so it's fairly easy to find situations where a number printed and read back yields a different bit pattern that is really hard to detect if you don't look at the bits (except for the trivial unequality), but for a Common Lisp system, that is basically unforgiveable. If you're not an expert at numerical analysis, the simple dictum is: don't presume to know how to read or print floating point numbers but do show respect for those who are experts and do know how. (I fall in the latter category, not the former of these, which is why I keep stressing that a correct parse-float function that maintains print-read consistency is heavily implementation-dependent and you shoult not mix third-party readers with builtin printers, unless you know what you're doing extremely well.) #:Erik -- If this is not what you expected, please alter your expectations.