home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!nobeltech!leeu
- From: leeu@nobeltech.se (Leif Euren)
- Newsgroups: comp.lang.ada
- Subject: Re: Ada Readability, Book Reference
- Message-ID: <1993Jan4.093155.11894@nobeltech.se>
- Date: 4 Jan 93 09:31:55 GMT
- References: <9212281507.AA20416@ajpo.sei.cmu.edu> <1992Dec30.035143.10291@seas.gwu.edu>
- Organization: NobelTech AB
- Lines: 52
-
-
-
-
- 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?".
-
- I think the answer should have been "The answer to the question is
- compiler dependant.", and therefore: Yes, Ada is readable, although I
- can express compiler dependant programs using it.
-
- And in article <1992Dec30.035143.10291@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) responded:
- >The particular example depends on the evaluation order of the sides of
- >the expression ... 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.
-
- Er... This is not a very good example. The constants used are of
- universal_real type, and according to LRM 4.10(4) "... if a universal
- expression is a static expression, then the evaluation must be exact."
-
- But if I write
-
- B := 1.0;
-
- if 6.0 * (B / 3.0) = (6.0 * B) / 3.0 then
-
- else
-
- end if;
-
- your arguments hold true.
- __ __
- | \ | All opinions are my own, even if my employer claims otherwise!
- | \ |
- | | Leif Euren NobelTech Systems AB
- | \ | System Manager Rational S-175 88 JARFALLA
- |__ \__| tel: +46-758-84072 Sweden
-