Article View: borland.public.jbuilder.java.language
Article #16380Re: 0.3-0.2=0.999999999998?
From: Tor Iver Wilhelmsen
Date: Fri, 05 Mar 1999 00:00
Date: Fri, 05 Mar 1999 00:00
17 lines
1758 bytes
1758 bytes
roedy@mindprod.com (Roedy Green) writes: > I disagree. Binary arithmetic is faster and simpler. The repeaters > just move to different places. You can't get rid of them. 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). Yes, but even slow 8-bit CPUs in the late seventies had a "binary coded decimal"-mode which fit two decimal digits into a byte, using a nibble (that's four bits, young'uns) for each. (That is, the decimal number 42 was encoded as the hex number 0x42). Adding 1 to 0x99 thus yielded 0x00 and carry/overflow. Kinda opens a possibility for maths akin to how BigDecimal and friends do their stuff - as long as you remembered to adjust your decimal point correctly.
Technical Details
Message-ID:
<wkk8wwlumi.fsf@mail.online.no>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: Tor Iver Wilhelmsen <toriw@online.no> Subject: Re: 0.3-0.2=0.999999999998? Date: 1999/03/05 Message-ID: <wkk8wwlumi.fsf@mail.online.no> X-Deja-AN: 451336922 Sender: unknown@TORIVER References: <7blg56$2pl$1@zonnetje.NL.net> <36DE833A.DFA9E627@alphalink.com.au> <36e3c58e.73834728@news.bctel.ca> X-Complaints-To: abuse@online.no X-Trace: news1.online.no 920589073 148.122.193.64 (Fri, 05 Mar 1999 00:11:13 MET DST) Organization: Telenor Online Public Access NNTP-Posting-Date: Fri, 05 Mar 1999 00:11:13 MET DST Newsgroups: borland.public.jbuilder.java.language,comp.lang.java,comp.lang.java.programmer