home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!SEQUENT.CC.HULL.AC.UK!R.A.REESE
- Via: uk.ac.hull.cc.sequent; Thu, 21 Jan 1993 09:24:05 +0000
- X-Mailer: ELM [version 2.3 PL11]
- Original-Sender: R.A.Reese@sequent.cc.hull.ac.uk
- Message-ID: <SPSSX-L%93012104242188@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.spssx-l
- Date: Thu, 21 Jan 1993 09:23:43 WET
- Reply-To: "R.A.Reese" <R.A.Reese@SEQUENT.CC.HULL.AC.UK>
- Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.BITNET>
- From: "R.A.Reese" <R.A.Reese@SEQUENT.CC.HULL.AC.UK>
- Subject: Re: Not BUG - digital computer
- Comments: To: JENSEN@XANADU.CC.UTAH.edu
- Comments: cc: SPSSX-L list <spssx-l@uga.cc.uga.edu>
- In-Reply-To: <no.id>; from "Jeffrey B. Jensen" at Jan 20, 93 5:30 pm
- Lines: 32
-
- From a glance I think your problem is just in not realizing that "exact" decimal
- fractions do not necessarily have an exact representation in a finite binary
- notation. Almost always this doesn't matter, since the "error" is in the least
- significant bit, so is of the order of, say, 1 in 2^32. When you do the
- arithmetic
- and then round the answer for printing to some "sensible" precision, you don't
- see the error. However, two special cases have to be taken into account:
-
- 1) comparing REAL values for exact equality (as you have done) is quite likely
- to
- fail.
- 2) if you do lots of calculations and haven't analyzed the algorithm, the errors
- may accumulate, and you may lose all precision. This is the basis of the
- continuing
- and recurring debate between the "why can't I just copy the formula from the
- book
- into a spreadsheet and save the cost of a package" and the "don't trust the
- answers
- except from a bona fide and well-tested package" schools.
-
- Footnote: it is one of pieces of computing folklore that various fraudsters,
- working in banks, have arranged for all the rounding errors in customer accounts
- to be diverted into a ghost account from which they are then able to make
- personal
- withdrawals. It's such a nice idea that I fear it's probably an urban myth.
-
- --
- (R.) Allan Reese Janet: r.a.reese@uk.ac.hull
- Head of Applications Direct voice: +44 482 465296
- Computer Centre Voice messages: +44 482 465685
- Hull University Fax: +44 482 466441
- Hull HU6 7RX, U.K.
-