Re: Q: division vs multiplication

pcg@aber.ac.uk (Piercarlo Grandi)
Mon, 17 Apr 1995 18:08:38 GMT

          From comp.compilers

Related articles
[7 earlier articles]
Re: Q: division vs multiplication Terje.Mathisen@hda.hydro.com (1995-04-06)
Re: Q: division vs multiplication meissner@cygnus.com (Mike Meissner) (1995-04-16)
Re: Q: division vs multiplication martens@cis.ohio-state.edu (1995-04-16)
Re: Q: division vs multiplication jmccarty@spdmail.spd.dsccc.com (1995-04-18)
Re: Q: division vs multiplication leichter@zodiac.rutgers.edu (1995-04-11)
Re: Q: division vs multiplication kptben@aol.com (1995-04-17)
Re: Q: division vs multiplication pcg@aber.ac.uk (1995-04-17)
Re: Q: division vs multiplication gsc@magna.com.au (1995-04-18)
Re: Q: division vs multiplication jbuck@Synopsys.COM (1995-04-28)
Re: Q: division vs multiplication davidm@flora.Rational.com (1995-04-28)
Re: Q: division vs multiplication Roger@natron.demon.co.uk (Roger Barnett) (1995-04-28)
Re: Q: division vs multiplication jmccarty@spdmail.spd.dsccc.com (1995-04-29)
| List of all articles for this month |

Newsgroups: comp.compilers
From: pcg@aber.ac.uk (Piercarlo Grandi)
Keywords: arithmetic
Organization: Prifysgol Cymru, Aberystwyth
References: 95-04-059 95-04-079
Date: Mon, 17 Apr 1995 18:08:38 GMT

>>> On Sun, 16 Apr 1995 19:12:11 GMT, Mike Meissner <meissner@cygnus.com> said:


Mike> David Gay's high quality implementation of strtod/dtoa (convert double
Mike> to ascii) routines lists the following in the source:


Mike> "How to Read Floating Point Numbers Accurately", by William
Mike> D. Clinger, Proceedings of the ACM, SIGPLAN 1990, pages 92-101.


Mike> and:


Mike> "How to Print Floating-Point Numbers Accurately" by Guy L. Steele,
Mike> Jr. and Jon L. White, Proceedings of the ACM, SIGPLAN 1990, pages
Mike> 92-101.


Mike> You can get dtoa from netlib (netlib.att.com:/netlib/fp).


I remember an amazingly well written TR on the subject by somebody
(probably by Dick Winter) at the Matematische Centrum, Amstserdam, now
CWI. Perhaps if you look around on "ftp.CWI.nl" it will turn up. It was
about how doing good floating point transput in an algol 68 compiler
(the TR is twenty years old :->, time flies).


The basic observation was that the only really safe way was to carefully
convert every floating point number to long unpacked decimal (strings)
to start with, and then do all arithmetic on the unpacked decimal
strings. The TR was prompted by the practical observation that in
Fortran several clever guy gos to great lengths to have 1-2 at most bits
of inaccuracy in their results, and print them with library functions
that have 4-5 bits of inaccuracy.


This little problem seems to have been rediscovered, thanks to the
amazingly awful formatted transput functions in most C libraries.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.