From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 16 Jul 93 20:21:38 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!darwin.sura. net!uvaarpa!software.org!smithd@ucbvax.Berkeley.EDU (Doug Smith) Subject: Re: Ada generics, numerics, and conversions Message-ID: <1993Jul16.202138.10676@software.org> List-Id: > In article <1993Jul15.224245.3907@software.org> smithd@software.org (Doug Smi th) writes: > > [example deleted] > > The results of executing the program are: > > 2147483647 > > ** MAIN PROGRAM ABANDONED -- EXCEPTION "numeric_error" RAISED > > > > [reference to 4.6(7)] > > > > Well, for my machine, 2147483647 is the nearest integer to > > 1.0/0.0000000000000000001. However, it seems inconsistent > > [...] > From: pelakh@convex.com (Boris Pelakh) > 2147483647 is nowhere near 1.0/0.0000000000000000001, its just integer'last > for a 32 bit representation. I think your second assignment is doing the righ t > thing, ie raising numeric_error (to be constraint in 9x). Whereas your generi c > is losing it. Look at the assembly, see what it does ... > From: eachus@spectre.mitre.org (Robert I. Eachus) > First of all, the nearest integer (small i) to > 1.0/0.0000000000000000001 is 10000000000000000000, assuming > Float'MANTISSA >= 45. The nearest value of the type Standard.Integer > is irrelevant. Thank you. Yes I had misinterpreted the LRM to mean the nearest Standard.Integer. But Robert I. Eachus continues, and suggests that Constraint_Error is the correct behavior according to the LRM: > Second, 4.6(2) and 4.6(12) are explict about when ^3 in my annotated LRM > CONSTRAINT_ERROR must be raised on a type conversion which is out of > range. The permissions in 11.6(6) and 11.6(7) do not really apply, > but, especially given the recent ARG discussions on this issue, I > would hesitate to call any action absent a CONSTRAINT_ERROR or others > handler a bug. > > [Interesting points about 'Image] Unless there is some more response, the conclusion seems to be that the compiler is incorrect if it does not raise Constraint_Error in both cases. I suspected the first case was incorrect and appreciate the clear explanations (which will also help when submitting the bug report.) Thank you. Doug Smith