From: Warren on
Is there any is not-a-number or is-infinity test support in
Ada05+ (for floats)? Is there any being planned?

Just shooting from the hip, it would seem to be a standard
thing that should be included these days.

Obviously you'd also need Booleans to tell you if they are
supported or not, on your given platform.

Warren
From: Rod Chapman on
On Jul 15, 10:00 pm, Warren <ve3...(a)gmail.com> wrote:
> Is there any is not-a-number or is-infinity test support in
> Ada05+ (for floats)?  Is there any being planned?  

What is S'Valid supposed to return for an S which is
a floating-point NaN???
- Rod
From: J-P. Rosen on
Warren a �crit :
> Is there any is not-a-number or is-infinity test support in
> Ada05+ (for floats)? Is there any being planned?
>
If X /= X, then X is a NaN (see http://en.wikipedia.org/wiki/NaN)

Not sure if there is such a simple test for infinities...
--
---------------------------------------------------------
J-P. Rosen (rosen(a)adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
From: Simon Wright on
Rod Chapman <roderick.chapman(a)googlemail.com> writes:

> On Jul 15, 10:00 pm, Warren <ve3...(a)gmail.com> wrote:
>> Is there any is not-a-number or is-infinity test support in
>> Ada05+ (for floats)?  Is there any being planned?  
>
> What is S'Valid supposed to return for an S which is
> a floating-point NaN???

I thought it was supposed to produce False, but all the AARM seems to
say (13.9.2) is that the value needs to be normal and have a valid
representation for 'Valid to return True. It also lists the
circumstances under which invalid data can be created: they don't look
to me as though they include

NaN : constant Float := 0.0 / 0.0;

GNAT certainly reports 'Valid as False for +/-Inf & NaN.
From: Simon Wright on
Warren <ve3wwg(a)gmail.com> writes:

> Is there any is not-a-number or is-infinity test support in Ada05+
> (for floats)? Is there any being planned?

With GNAT, using a subtype

subtype Checked_Float is Float range Float'Range;

will give you a Constraint_Error for NaN or +/-Inf.