comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: Valid on QNaN generates exception, compiler bug?
Date: Fri, 1 Feb 2002 16:16:31 GMT
Date: 2002-02-01T16:16:31+00:00	[thread overview]
Message-ID: <3C5ABF5F.BBBAB407@boeing.com> (raw)
In-Reply-To: u1yg5z3xo.fsf@gsfc.nasa.gov

Stephen Leake wrote:
> 
> "Steve Doiel" <nospam_steved94@attbi.com> writes:
> 
> >   In ObjectAda 7.2 (WinNT x86) I have found that if I assign a value of
> > 16#FFC0_0000# (QNaN) to a 32 bit floating point value using unchecked
> > conversion, then I try to check the value using 'VALID, I get a
> > Constraint_Error, numeric overflow exception.
> >
> >   Is this a compiler bug?
> 
> No. "NaN" stands for "Not a Number". float_value'Valid checks to see
> if 'float_value' holds a valid floating point number. It does not, so
> Constraint_Error is raised.

ARM 13.9.2 says "X'Valid is not considered to be a read of X; hence, it
is not an error to check the validity of invalid data."

The whole point of 'Valid is that it doesn't raise an exception
regardless of the bit pattern stored in the object; otherwise it doesn't
add anything to the language.

-- 
Jeffrey Carter



  parent reply	other threads:[~2002-02-01 16:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-31  4:04 Valid on QNaN generates exception, compiler bug? Steve Doiel
2002-02-01 14:12 ` Stephen Leake
2002-02-01 14:51   ` Steve Doiel
2002-02-01 21:11     ` Robert Dewar
2002-02-01 22:13       ` Steve Doiel
2002-02-01 16:16   ` Jeffrey Carter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-01-31  4:04 Steve Doiel
replies disabled

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