Article View: borland.public.jbuilder.java.language
Article #16308Re: 0.3-0.2=0.999999999998?
From: glen herrmannsfeldt
Date: Mon, 08 Mar 1999 00:00
Date: Mon, 08 Mar 1999 00:00
27 lines
1828 bytes
1828 bytes
roedy@mindprod.com (Roedy Green) writes: (regarding decimal floating point) >Mike Cowlishaw (The inventor of Rexx and NetRexx) would agree with >you. He has been lobbying for floating point hardware to be >redesigned to work in base 10 rather than base 2 to avoid these >anomalies. People are used to .3333... + .66666 = .9999 but they >don't expect 0.1 to behave the same way. I tried to discuss this on comp.arch, mostly saying that chip density is high enough to add decimal floating point, along with binary. >I disagree. Binary arithmetic is faster and simpler. The repeaters >just move to different places. You can't get rid of them. With appropriate hardware, decimal floating point would be fast enough. >If you >want absolute precision, use scaled integer arithmetic which is many >times faster that floating point (e.g. integer pennies for currency, >with a decorative decimal point inserted for display). I do believe that fixed point arithmetic should be used for all financial calculations, and, like D.E.Knuth, for all typesetting calculations. -- glen
Technical Details
Message-ID:
<7c198o$2d4@gap.cco.caltech.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7blg56$2pl$1@zonnetje.NL.net> <36DE833A.DFA9E627@alphalink.com.au> <36e3c58e.73834728@news.bctel.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5d71,3b89176b465afef X-Google-Attributes: gidf5d71,public X-Google-Thread: f74b3,3b89176b465afef X-Google-Attributes: gidf74b3,public X-Google-Thread: 10a146,3b89176b465afef X-Google-Attributes: gid10a146,public From: gah@ugcs.caltech.edu (glen herrmannsfeldt) Subject: Re: 0.3-0.2=0.999999999998? Date: 1999/03/08 Message-ID: <7c198o$2d4@gap.cco.caltech.edu> X-Deja-AN: 452875534 References: <7blg56$2pl$1@zonnetje.NL.net> <36DE833A.DFA9E627@alphalink.com.au> <36e3c58e.73834728@news.bctel.ca> Organization: California Institute of Technology, Pasadena Newsgroups: borland.public.jbuilder.java.language,comp.lang.java,comp.lang.java.programmer