From: robin on
m_b_metcalf wrote in message <83d9c160-d7f6-4c1b-9b4b-2e6fe7e68ccb(a)s9g2000yqd.googlegroups.com>...
>On Jul 17, 3:42 pm, "analys...(a)hotmail.com" <analys...(a)hotmail.com>
>wrote:
>> In a**b are there any restrictions on the data types of a and b - or
>> will the language handle all numeric cases?

>All combinations of intrinsic numeric types are permitted (MR&C, Table
>3.2) but you cannot raise a negative real value to a real power.

As we're dealing with exceptions, 0**0 in their various forms
is not permitted either.


From: Phillip Helbig---undress to reply on
In article
<aacabb4b-c8f0-41a5-ad9d-5256306515c6(a)l25g2000prn.googlegroups.com>,
steve <kargls(a)comcast.net> writes:

> > The "foro" symbol includes "/STANDARD=3DF95/WARNINGS=3DALL".
> >
> > What am I missing?
>
> A descent compiler?

Maybe. It is rather old, 10 years or so.

Is the consensus here that

print*, (-1.0)**2.0
end

is illegal (i.e. doesn't conform to the standard)? (If so, presumably
the compiler should warn about it, at least if asked to warn about
non-standard stuff.)

Changing the values slightly so that they are no longer "round" values,
I get

%MTH-F-UNDEXP, undefined exponentiation

at run time but not at compile time.

From: steve on
On Jul 17, 8:54 am, hel...(a)astro.multiCLOTHESvax.de (Phillip Helbig---
undress to reply) wrote:
> In article
> <aacabb4b-c8f0-41a5-ad9d-525630651...(a)l25g2000prn.googlegroups.com>,
>
> steve <kar...(a)comcast.net> writes:
> > > The "foro" symbol includes "/STANDARD=3DF95/WARNINGS=3DALL".
>
> > > What am I missing?
>
> > A descent compiler?
>
> Maybe.  It is rather old, 10 years or so.
>
> Is the consensus here that
>
>    print*, (-1.0)**2.0
>    end
>
> is illegal (i.e. doesn't conform to the standard)?

Of course, otherwise, gfortran would says it is prohibited.
But, if you want the exact text from F2003 (Sec. 7.1.8):

The execution of any numeric operation whose result is
not defined by the arithmetic used by the processor is
prohibited. Raising a negative-valued primary of type
real to a real power is prohibited.

--
steve
From: steve on
On Jul 17, 9:08 am, steve <kar...(a)comcast.net> wrote:
> On Jul 17, 8:54 am, hel...(a)astro.multiCLOTHESvax.de (Phillip Helbig---
>
>
>
> undress to reply) wrote:
> > In article
> > <aacabb4b-c8f0-41a5-ad9d-525630651...(a)l25g2000prn.googlegroups.com>,
>
> > steve <kar...(a)comcast.net> writes:
> > > > The "foro" symbol includes "/STANDARD=3DF95/WARNINGS=3DALL".
>
> > > > What am I missing?
>
> > > A descent compiler?
>
> > Maybe.  It is rather old, 10 years or so.
>
> > Is the consensus here that
>
> >    print*, (-1.0)**2.0
> >    end
>
> > is illegal (i.e. doesn't conform to the standard)?
>
> Of course, otherwise, gfortran would says it is prohibited.
> But, if you want the exact text from F2003 (Sec. 7.1.8):

Replying to self :(

s/would says/would not say/

(Sigh. Not enough coffee, yet!)

--
steve

From: Gordon Sande on
On 2010-07-17 12:54:26 -0300, helbig(a)astro.multiCLOTHESvax.de (Phillip
Helbig---undress to reply) said:

> In article
> <aacabb4b-c8f0-41a5-ad9d-5256306515c6(a)l25g2000prn.googlegroups.com>,
> steve <kargls(a)comcast.net> writes:
>
>>> The "foro" symbol includes "/STANDARD=3DF95/WARNINGS=3DALL".
>>>
>>> What am I missing?
>>
>> A descent compiler?
>
> Maybe. It is rather old, 10 years or so.
>
> Is the consensus here that
>
> print*, (-1.0)**2.0
> end
>
> is illegal (i.e. doesn't conform to the standard)? (If so, presumably
> the compiler should warn about it, at least if asked to warn about
> non-standard stuff.)
>
> Changing the values slightly so that they are no longer "round" values,
> I get
>
> %MTH-F-UNDEXP, undefined exponentiation
>
> at run time but not at compile time.

A common extension/optimization is to treat x**2.0 as if it were x**2 which
allows for simpler algorithms. (-1.0)**2 would be OK.