home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
- From: progers@ajpo.sei.cmu.edu (Pat Rogers)
- Subject: Re: Ada Readability, Book Reference
- Message-ID: <1993Jan5.115003.29978@sei.cmu.edu>
- Summary: rational arithmetic and universal expressions
- Sender: netnews@sei.cmu.edu (Netnews)
- Organization: Ada Joint Program Office
- References: <1992Dec30.035143.10291@seas.gwu.edu> <1993Jan4.093155.11894@nobeltech.se> <1993Jan4.174424.5699@seas.gwu.edu>
- Date: Tue, 5 Jan 1993 11:50:03 EST
- Lines: 52
-
- In article <1993Jan4.174424.5699@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes:
- >
- >Hmmm. How on earth could 1.0/3.0 be exact? What would the value be?
- >
- >I checked my Annotated LRM (thanks to Karl Nyberg!) and found AI-00209:
- >"An implementation can refuse to evaluate a static universal real expression
- >only if there are insufficient resources to evaluate the expression exactly,
- >e.g., if there is insufficient memory available. Inexact results must not
- >be delivered."
- >
- >This is interesting. I take it, then, that 1.0/3.0 will be flagged by
- >the compiler, because - unless a rational representation is being
- >used, which is always possible, I suppose - there aren't enough bits
- >in a megabyte to evaluate it exactly. Do compilers use rationals
- >for this? I'll be back later, after a test or two of this!
- >
- >Mike Feldman
- >------------------------------------------------------------------------
- >Michael B. Feldman
- >co-chair, SIGAda Education Committee
- >
-
- About seven years ago I saw this program (I think by John Squires) on
- info-ada (this is a reconstruction from memory). See how long it takes
- your compiler to give up on it -- use a batch queue if you can, especially
- on a virtual memory machine. If it does eventually compile, you can just
- add lines until it won't...
-
- Pat Rogers
- progers@ajpo.sei.cmu.edu
-
- -------- cut here --------
-
- procedure Killer is
-
- A : constant := 1.0 / 3.0;
-
- B : constant := A * A * A * A * A * A * A * A * A * A * A * A * A;
- C : constant := B * B * B * B * B * B * B * B * B * B * B * B * B;
- D : constant := C * C * C * C * C * C * C * C * C * C * C * C * C;
- E : constant := D * D * D * D * D * D * D * D * D * D * D * D * D;
- F : constant := E * E * E * E * E * E * E * E * E * E * E * E * E;
- G : constant := F * F * F * F * F * F * F * F * F * F * F * F * F;
- H : constant := G * G * G * G * G * G * G * G * G * G * G * G * G;
- I : constant := H * H * H * H * H * H * H * H * H * H * H * H * H;
- J : constant := I * I * I * I * I * I * I * I * I * I * I * I * I;
- K : constant := J * J * J * J * J * J * J * J * J * J * J * J * J;
- L : constant := K * K * K * K * K * K * K * K * K * K * K * K * K;
-
- begin
- null;
- end Killer;
-