comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: intermediate results causing constraint errors
Date: 6 Dec 1994 08:40:22 -0500
Date: 1994-12-06T08:40:22-05:00	[thread overview]
Message-ID: <3c1pk6$jk4@gnat.cs.nyu.edu> (raw)
In-Reply-To: D0Cp98.1AK@inmet.camb.inmet.com

OK, there are two issues here, and I think Bob is talking about one, and
Richard about the other.

From what I understand of Richard's position, he would like a guarantee
that no intermediate results cause constraint error ever. That seems
quite impractical, since it would result in harmless expressions like

   Mid := (hi + lo) / 2

generating calls to runtime multiple precision packages etc. which you
certainly don't want. I just sent Richard a much more detailed discussion
of this point (Richard, feel free to repost that response here if you think
it is useful to do so).

Bob is noting that the optimization rules (the infamous 11.6 section of
the RM (which was briefly 11.7 in 9X, but this section number is so well
known, that people complained, and now it is once more 11.6 again in 9X :-)

allow compilers to avoid giving the constraint error if they give the
"right result".

This of course introduces non-portabilities, but if one insisted that
intermediate results always be checked it would generate annoying extra
code. Consider:

   X := A * B / C;

on many machines multiply and divide handle double length results free, so
the check would make things inefficient.

It would be nice if Ada compilers at least had an option to guarantee
that they checked all intermediate results, so you could be sure your
code was portable, although there are still problems with different
base types for integers.





  parent reply	other threads:[~1994-12-06 13:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3bn3l9$pa2@gnat.cs.nyu.edu>
1994-12-05 18:41 ` intermediate results causing constraint errors Bob Duff
1994-12-05 19:20   ` Bob Duff
1994-12-06  0:50   ` Keith Thompson
1994-12-06  8:00   ` Richard Riehle
1994-12-06 13:40   ` Robert Dewar [this message]
1994-12-07 17:17     ` Richard Riehle
1994-12-10 13:41       ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox