home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!seas.gwu.edu!mfeldman
- From: mfeldman@seas.gwu.edu (Michael Feldman)
- Subject: Re: Ada Readability, Book Reference
- Message-ID: <1992Dec30.035143.10291@seas.gwu.edu>
- Sender: news@seas.gwu.edu
- Organization: George Washington University
- References: <9212281507.AA20416@ajpo.sei.cmu.edu>
- Date: Wed, 30 Dec 1992 03:51:43 GMT
- Lines: 45
-
- In article <9212281507.AA20416@ajpo.sei.cmu.edu> SAHARBAUGH@ROO.FIT.EDU writes:
- >I received one request for a pointer to Bryan & Mendal's
- >book so I may as well post it (same amount of keystrokes).
- >
- [stuff deleted]
- >
- >For many examples the book asks, "What will this
- >program print?" For example 7.3.12 the answer is
- >"The answer to the question is indeterminate."
- >
- >So I ask "Is Ada readable if you can express an indeterminate
- >program using it?".
- >
- The particular example depends on the evaluation order of the sides
- of the expression, but more fundamentally, speaks to the approximations
- inherent in floating point. Ada's readability has little to do with it -
- it's characteristic of digital computers that floating-point arithmetic
- has indeterminate results sometimes, so that (A*B)/C may yield a different
- result than A*(B/C).
-
- In the specific case, (6.0 * 1.0)/3.0 can yield a different result from
- 6.0 * (1.0 / 3.0) because 1.0/3.0 cannot be exactly represented.
- Therefore an expression like
- 6.0 * (1.0 / 3.0) = (6.0 * 1.0) / 3.0
- may not evaluate to True. Traditional floating-point gotcha.
-
- You chose an example that doesn't make your point very well, because a
- programming language can't fix problems inherent in trying to approximate
- the real numbers in a finite number of bits.
-
- Mike Feldman
- ------------------------------------------------------------------------
- Michael B. Feldman
- co-chair, SIGAda Education Committee
-
- Professor, Dept. of Electrical Engineering and Computer Science
- School of Engineering and Applied Science
- The George Washington University
- Washington, DC 20052 USA
- (202) 994-5253 (voice)
- (202) 994-5296 (fax)
- mfeldman@seas.gwu.edu (Internet)
-
- "Americans want the fruits of patience -- and they want them now."
- ------------------------------------------------------------------------
-