Syntax of a Complex (ANSI and GNU Common Lisp Document)

Previous: Syntax of a Float, Up: Constructing Numbers from Tokens

#### 2.3.2.5 Syntax of a Complex

A complex has a Cartesian structure, with a real part and an imaginary part each of which is a

real.

The parts of a complex are not necessarily floats but both parts must be of the same type:

[Editorial Note by KMP: This is not the same as saying they must be the same type. Maybe we mean they are of the same ‘precision’ or ‘format’? GLS had suggestions which are not yet merged.] either both are rationals, or both are of the same float subtype. When constructing a complex, if the specified parts are not the same type, the parts are converted to be the same type internally (i.e., the rational part is converted to a float). An object of type `(complex rational)` is converted internally and represented thereafter as a rational if its imaginary part is an integer whose value is 0.

For further information, see Sharpsign C and Printing Complexes.