[Cfp-interest 3332] special cases of cpow

Paul Zimmermann Paul.Zimmermann at inria.fr
Thu Nov 21 06:42:32 PST 2024


       Hi,

with Andreas Enge (in cc), co-author of GNU MPC, we wonder about the special cases of
the complex power, in particular when one of the arguments has a zero part (+0 or -0).

For the real power, IEEE 754 completely specifies the special cases of pow.

Is there a similar document for the complex power? N3301 only says "The cpow functions compute
the complex power function xy, with a branch cut for the first parameter along the negative real
axis." and "This allows cpow(z, c) to be implemented as cexp(c*clog(z)) without precluding
implementations that treat special cases more carefully".

For example, what should (-4,+0) ^ (0.5, +0) return? (+0, 2) or (-0,2)?
If we replace each +0 by a tiny value, we get different signs for the real part of the
result depending on the ratio of these tiny values:

sage: e=1e-6
sage: (-4+e*i)^(0.5+e^2*i)
2.49997227485645e-7 + 1.99999999999373*I
sage: (-4+e^2*i)^(0.5+e*i)
-2.77257976169088e-6 + 1.99999371682264*I

Paul




More information about the Cfp-interest mailing list