On Jun 23, 2005, at 6:23 AM, F2k3 wrote:
> USE, INTRINSIC :: IEEE_FEATURES, ONLY: IEEE_ROUND
I assume you mean IEEE_ROUNDING. There is no IEEE_ROUND that I see
offhand (though I don't have this stuff all internalized and have to
look it up, so it is always possible that I missed something, but this
looks like you mean IEE_ROUNDING).
> USE, INTRINSIC :: IEEE_ARITHMETIC
> PRINT *, IEEE_SUPPORT_DENORMAL() ! <--(A)
> END
>
> Q. Assuming that there is hardware support for
> denormal numbers for all reals
Point 1. Hardware support has absolutely nothing to do with anything in
the standard. The standard's use of the term "processor" does not mean
the hardware processor. It means the whole system, specifically
including the compiler. It is more accurate to read the standard's
"processor" as "compiler"; not quite completely correct, but that's a
closer approximation to the meaning than "hardware". A compiler can
support all the IEEE stuff without any hardware floating point at all
(slow, but it is allowed). Conversely, a compiler can refuse to support
any of the IEEE features even if the hardware supports them all. This
really is quite an important distinction.
So I will translate your statement as "assuming the compiler supports
denormals for all reals."
> and IEEE_FEATURES
> module defines the named constant, IEEE_DENORMAL.
That doesn't matter since you don't access it. The fact that the module
defines that constant means that the compiler is capable of supporting
IEEE denormals. But it is possible that the support might make code
inefficient on some processors (in fact, yes, there are processors
where it does). Therefore, the processor doesn't have to use its
support of that if you don't demand it. USEing IEEE_DENORMAL would be
how you demand it.
> What should be the output for the print statement in (A)?
Processor-dependent (but either true or false). That's exactly the
point of the function. You haven't demanded support, but you can
inquire whether you are getting it anyway. You have basically left it
up to the compiler to choose. Odds are that the result will probably be
true if the support is "cheap" (in terms of efficiency), but false if
the support is expensive.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|