comp.lang.ada
 help / color / mirror / Atom feed
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
Date: 16 Jul 93 20:21:38 GMT	[thread overview]
Message-ID: <1993Jul16.202138.10676@software.org> (raw)

> 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

             reply	other threads:[~1993-07-16 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-07-16 20:21 Doug Smith [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-07-16 16:44 Ada generics, numerics, and conversions Robert I. Eachus
replies disabled

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