http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57749

--- Comment #7 from Vittorio Zecca <zeccav at gmail dot com> ---
Looking at the source code for cpowf, it computes x**y straightly as
exp(y*log(x)),
no check on y or x.

I am not happy with that, because I expect that complex zero raised to any
(real or integer) positive power should be zero. No exceptions raised.
I do not know if this is correct, but it looks reasonable to me.
Computing complex zero**1 delivers (0.0,0.0),
but complex zero**1.0 raises an exception.
How strange.
This is reading the base and exponent, no optimization involved.
As in:
      complex zero
      read *,zero,i,x
      print *,zero,i,x
      print *,zero**i
      print *,zero**x

When both numbers are complex, the standards (F95, F2003, and F2008)
state that "the value of the operation x1**x2 is the principal value of
x1 raised to x2". Does it help?
When aimag(x2) is zero what is the principal value?
I cannot believe that zero**1e0 is a singularity.
The Intel ifort compiler delivers the "reasonable" result,
it even goes beyond that and computes zero**zero as (1.0,0.0)!

And I still believe the result should not depend on the optimization level.
Note that compiling without -ffpe-trap the result
with default optimization, -O0, is (  0.00000000    , -0.00000000    ),
higher optimizations deliver (  0.00000000    ,  0.00000000    ).
Another mystery.

Reply via email to