From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,da29ac1b3f986998 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-06 07:08:13 PST Path: bga.com!news.sprintlink.net!hookup!news.mathworks.com!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: intermediate results causing constraint errors Date: 6 Dec 1994 08:40:22 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3c1pk6$jk4@gnat.cs.nyu.edu> References: <3bn3l9$pa2@gnat.cs.nyu.edu> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-12-06T08:40:22-05:00 List-Id: 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.