# Version 1.8 of ais/ai-00156.txt

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

!standard G.1.1 (55)          00-07-31 AI95-00156/07
!class binding interpretation 96-09-04
!status Corrigendum 2000 99-05-27
!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
!qualifier Error
!subject Polar implementation of complex exponentiation for negative exponents
!summary
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
G.1.1(55) gives the following method for doing complex exponentiation in polar form:
... 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
(See summary.)
!wording
(See summary.)
!discussion
Here is a proof by example that the given method is incorrect:
Assume that the method described in the standard is correct. Let a complex number X = 0+I. Let an integer n = -1. Then
X**n = 1/i = -i
argument(X) = pi/2 and n is negative. So, according to G.1.1(55), argument(X**n) = (pi/2)/|-1| = pi/2, but argument(X**n) = argument(-i) = -pi/2
Obviously, pi/2 is not equal to -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 method described in G.1.1(55) was correct. So, it must not be.
!corrigendum G.01.01(55)
Replace the paragraph:
Implementations may obtain the result of exponentiation of a complex or pure-imaginary operand by repeated complex multiplication, with arbitrary association of the factors and with a possible final complex reciprocation (when the exponent is negative). 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, when the exponent is positive, or dividing the argument by the absolute value of the given exponent, when the exponent is negative; and reconverting to a cartesian representation. Because of this implementation freedom, no accuracy requirement is imposed on complex exponentiation (except for the prescribed results given above, which apply regardless of the implementation method chosen).
by:
Implementations may obtain the result of exponentiation of a complex or pure-imaginary operand by repeated complex multiplication, with arbitrary association of the factors and with a possible final complex reciprocation (when the exponent is negative). 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. Because of this implementation freedom, no accuracy requirement is imposed on complex exponentiation (except for the prescribed results given above, which apply regardless of the implementation method chosen).
!ACATS test
This is a correction of a permission for an implementation to use a non-canonical algorithm. This is not testable.
!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