# Version 1.2 of ais/ai-00156.txt

Unformatted version of ais/ai-00156.txt version 1.2
Other versions for file ais/ai-00156.txt

!standard G.1.1 (55)          98-06-12 AI95-00156/03
!class binding interpretation 96-09-04
!status WG9 approved 98-06-12
!status ARG Approved (with changes) 12-0-1 97-11-16
!status work item 96-09-08
!priority Medium
!difficulty Medium
!subject Polar implementation of complex exponentiation for negative exponents
!summary 98-03-27
The second sentence of G.1.1(55) should read:
Implementations are also permitted to obtain the result of exponentiation of a complex operand, but not of a pure-imaginary operand, by converting the left operand to a polar representation, exponentiating the modulus by the given exponent, multiplying the argument by the given exponent, and reconverting to a cartesian representation.
!question 96-09-08
G.1.1(55) gives the following method for doing complex exponentiation in polar form in G.1.1(55):
... exponentiating the modulus by the given exponent; multiplying the argument by the given exponent, when the exponent is positive, or dividing the argument by the absolute value of the given exponent, when the exponent is negative; ...
The special case for the determining the argument of the result when the exponent is negative is incorrect. The method given for positive exponents should be applied for all exponents, including interestingly enough, zero exponents.
!recommendation 98-03-27
(See summary.)
!wording 98-03-27
(See summary.)
!discussion 96-09-08
Here is a proof by example that the given method is incorrect:
assume that the RM95 method is correct. let a complex number X=0+i let an integer n=-1
X**n=1/i X**n=(1/i)*(i/i)=(i/-1)=-i
argument(X)=pi/2 n is negative. So, according to the RM95, argument(X**n)=(pi/2)/|-1|=pi/2
but, argument(X**n)=argument(-i)=-pi/2
pi/2 /= -pi/2 (even as an angle) i.e. a contradiction has been found. No zero-valued complex numbers were involved (they can mess things up). The only dubious assumption made was that the RM95 method was correct. So, it must not be.
!appendix
```
!section G.1.1(55)
!subject Polar implementation of complex exponentiation for negative exponents incorrect.
!reference RM95-G.1.1(55)
!from Joel VanLaven 96-07-18
!reference 96-5623.a Joel VanLaven 96-7-18>>
!discussion

The RM95 gives the following method for doing complex exponentiation
in polar form in G.1.1(55) (removed from context for clarity):

"... exponentiating the modulus by the given exponent; multiplying
the argument by the given exponent, when the exponent is positive, or
dividing the argument by the absolute value of the given exponent, when the
exponent is negative; ..."

The special case for the determining the argument of the result when the
exponent is negative is incorrect.  The method given for positive exponents
should be applied for all exponents, including interestingly enough, zero
exponents.

Here is a proof by example that the given method is incorrect:

assume that the RM95 method is correct.
let a complex number X=0+i
let an integer n=-1

X**n=1/i
X**n=(1/i)*(i/i)=(i/-1)=-i

argument(X)=pi/2
n is negative.  So, according to the RM95,
argument(X**n)=(pi/2)/|-1|=pi/2

but, argument(X**n)=argument(-i)=-pi/2

pi/2 /= -pi/2 (even as an angle) i.e. a contradiction has been found
no zero-valued complex numbers were involved (they can mess things up).
The only dubious assumption made was that the RM95 method was correct.
So, it must not be.

A correct RM might read (minimal change):

"... exponentiating the modulus by the given exponent; multiplying
the argument by the given exponent; ..."

****************************************************************

!section G.1.1(55)
!subject Polar implementation of complex exponentiation for negative exponents incorrect.
!reference RM95-G.1.1(55)
!reference Joel VanLaven 96-07-18
!from Ken Dritz 96-07-26
!reference 96-5624.a Ken Dritz  96-7-26>>
!discussion>

Joel VanLaven writes that the Implementation Permissions regarding the
implementation of complex exponentiation given in RM95-G.1.1(55) are wrong
(specifically the part applying to negative exponents), and he cites an
example.

Joel is entirely correct.  The second sentence of that paragraph should read as
follows:

"Implementations are also permitted to obtain the result of exponentiation of a
complex operand, but not of a pure-imaginary operand, by converting the left
operand to a polar representation, exponentiating the modulus by the given
exponent, multiplying the argument by the given exponent, and reconverting to a
cartesian representation."

Ken Dritz

****************************************************************

!section G.1.1(55)
!subject Polar implementation of complex exponentiation for negative exponents incorrect.
!reference RM95-G.1.1(55)
!reference Joel VanLaven 96-07-18
!reference 96-5624.a Ken Dritz  96-7-26
!from Robert I. Eachus 96-07-29
!reference 96-5626.a Robert I. Eachus 96-7-29>>
!discussion

Ken said:

> Joel is entirely correct.  The second sentence of that paragraph

> "Implementations are also permitted to obtain the result of
> exponentiation of a complex operand, but not of a pure-imaginary
> operand, by converting the left operand to a polar representation,
> exponentiating the modulus by the given exponent, multiplying the
> argument by the given exponent, and reconverting to a cartesian
> representation."

Looks good, just a couple nits:

Is the restriction on pure imaginary operands required?  Is there a
non-mathematical or accuracy reason for this restriction?

Also, paragraph 53 permits any sign for zero results when
Real'Signed_Zeros is true, but what about when it is false?  Is is
legal to compute (0.0,-2.0**-100)**2 as (0.0,0.0)?

Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...

****************************************************************
```

Questions? Ask the ACAA Technical Agent