# Issue: COMPLEX-RATIONAL-RESULT (version 1)

• To: CL-Cleanup@sail.stanford.edu
• Subject: Issue: COMPLEX-RATIONAL-RESULT (version 1)
• From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
• Date: Mon, 20 Mar 89 11:41 EST
• Cc: chapman%aitg.DEC@decwrl.dec.com

```This issue came up while reviewing section 2.2 of the draft standard.
Does anyone object if I mail this to X3J13 and bring it up at the
March meeting?  I couldn't find any sign that it has already been addressed.

Issue:         COMPLEX-RATIONAL-RESULT

References:    CLtL p.203

Category:      CLARIFICATION

Edit history:  Version 1, 20-Mar-89, by Moon

Problem description:

Referring to irrational and transcendental functions, CLtL says:

When the arguments to a function in this section are all rational and
the true mathematical result is also (mathematically) rational, then
unless otherwise noted an implementation is free to return either an
accurate result of type rational or a single-precision floating-point
approximation.  If the arguments are all rational but the result cannot
be expressed as a rational number, then a single-precision
floating-point approximation is always returned.

Referring to EXPT, CLtL says:

If the base-number is of type RATIONAL and the power-number is an
INTEGER, the calculation will be exact and the result will be of
type RATIONAL; otherwise a floating-point approximation may result.

What about arguments of type (complex rational)?

Proposal (COMPLEX-RATIONAL-RESULT:EXTEND):

Extend the paragraph quoted above to cover the components of complex
numbers.  For (complex rational) arguments, a mathematically rational
result can be rational, (complex rational), or (complex float) at the
discretion of the implementation.  For EXPT of a (complex rational) to
an integer power, the calculation must be exact and the result will
be rational or (complex rational).

Examples:

(log #c(-16 16) #c(2 2)) => 3 or approximately #c(3.0 0.0)
(expt #c(2 2) 3) => #c(-16 16)
(expt #c(2 2) 4) => -64

Rationale:

This seems most consistent with the treatment of real numbers.

Current practice:

Symbolics Genera 7.4 returns a (complex float) for the first example
and returns the specified answers for the second and third examples.
Other implementations were not surveyed.

Cost to Implementors:

Only EXPT would have to change, since the type of the other results
is at the discretion of the implementation.

Cost to Users:

Probably none, but it is hard to predict.

Slightly less self-consistent language.

Performance impact:

None of any significance.

Benefits/Esthetics:

More self-consistent language.

Discussion:

None.

```