On May 1, 1:04=A0am, "Stuart" <stu...@[EMAIL PROTECTED]
> wrote:
> "Adam Beneschan" <a...@[EMAIL PROTECTED]
> wrote in message
>
>
news:93b0d930-102a-4ac4-8b85-48e87d9d3df1@[EMAIL PROTECTED]
>=
On Apr 30, 3:50 am, christoph.gr...@[EMAIL PROTECTED]
wrote:
> >> On 30 Apr., 12:47, christoph.gr...@[EMAIL PROTECTED]
wrote:
>
> >> > Try Float'Valid (X), see RM 13.9.2
>
> >> Ahem, I meant X'Valid for X of type Float
>
> <snip>
>
> > The problem here is that if you're dealing with NaN's on purpose,
> > you're not really dealing with Ada, as far as I can tell, unless your
> > purpose is to test for an uninitialized variable (in which case
> > X'Valid makes sense). =A0Otherwise, though, NaN's and infinities are
not=
> > possible values of floating-point types, and therefore they can't be
> > returned by operations that return floating-point values, even if
> > Float'Machine_Overflows is False. =A0(There are certain passages in
the
> > RM that say a result is implementation-defined if the
> > Machine_Overflows attribute is False; however, I do not think
> > assigning a variable to an invalid value, as a NaN would be, is an
> > allowed "implementation-defined" result. =A013.9.2(4-11) lists the
ways
> > that invalid data could be created, and the "result of a floating-
> > point operation that cannot return a valid result" is not one of those
> > listed. =A0Yes, I know that this is a NOTE and is not normative.)
>
> Would not 13.9.2(10) cover this:
> =A0 =A0"disrupting an assignment due to the failure of a
language-defined =
check
> (see 11.6)"
>
> Thus if a floating point operation creates a NaN, which would indicate
an
> ill-conditioned computation that should violate some language-defined
chec=
k,
> the object (X) that was to receive the result would be considered
invalid.=
>
> As noted elsewhere, 'valid encomp***** more than NaNs - which may or may
n=
ot
> suit the OPs purpose.
Not sure. Apparently, the plotting example I'm translating from C
needs to check for NaN when the underlying surface plot machinery is
working. It seems odd that this heavy a responsibility should appear
to the user in an example, but that's out of my control. I suppose
'valid would work since I doubt that other pathologies would arise.
Jerry
>
> Regards
> --
> Stuart


|