Complex number arithmetic with rectangular and polar forms.
Literal syntax: a+bi, a-bi (e.g. 3+4i, 0+1i, 2-3i)
Extends arithmetic operators (+, -, *, /, =) with complex promotion.
number?Test whether a value is any numeric type (integer, rational, float, or complex).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a number
complex?Test whether a value is any numeric type (alias for number?).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a number
real?Test whether a value is a real number (integer, rational, or float, but not complex).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a real number
Complex(Complex complex? x)Test whether a value is any numeric type (alias for number?).
Parameters:
ANY — Value to testReturns: BOOL — True if x is a number
(Complex make re im)Construct a complex number from rectangular coordinates.
Parameters:
NUMBER — Real partNUMBER — Imaginary partReturns: COMPLEX|NUMBER — Complex number, or real if imaginary part is zero
(Complex from-polar mag ang)Construct a complex number from polar coordinates (magnitude and angle).
Parameters:
NUMBER — MagnitudeNUMBER — Angle in radiansReturns: COMPLEX|NUMBER — Complex number from polar coordinates
(Complex real-part z)Return the real part of a complex number, or the number itself for reals.
Parameters:
COMPLEX|NUMBER — Complex or real numberReturns: NUMBER — Real part
(Complex imag-part z)Return the imaginary part of a complex number, or 0 for reals.
Parameters:
COMPLEX|NUMBER — Complex or real numberReturns: NUMBER — Imaginary part
(Complex magnitude z)Return the magnitude (absolute value) of a complex or real number.
Parameters:
COMPLEX|NUMBER — Complex or real numberReturns: FLOAT — Absolute value (distance from origin)
(Complex angle z)Return the angle (argument) of a complex number in radians.
Parameters:
COMPLEX|NUMBER — Complex or real numberReturns: FLOAT — Angle in radians
(Complex + a b)Add two complex numbers (reals coerce).
Parameters:
COMPLEX|NUMBER — First operandCOMPLEX|NUMBER — Second operandReturns: COMPLEX|NUMBER — Sum, collapsed to real if imaginary part is zero
(Complex - a b)Subtract two complex numbers (reals coerce).
Parameters:
COMPLEX|NUMBER — First operandCOMPLEX|NUMBER — Second operandReturns: COMPLEX|NUMBER — Difference, collapsed to real if imaginary part is zero
(Complex * a b)Multiply two complex numbers (reals coerce).
Parameters:
COMPLEX|NUMBER — First operandCOMPLEX|NUMBER — Second operandReturns: COMPLEX|NUMBER — Product, collapsed to real if imaginary part is zero
(Complex / a b)Divide two complex numbers (reals coerce).
Parameters:
COMPLEX|NUMBER — DividendCOMPLEX|NUMBER — DivisorReturns: COMPLEX|NUMBER — Quotient, collapsed to real if imaginary part is zero
(Complex = a b)Test whether two complex numbers are equal (reals coerce).
Parameters:
COMPLEX|NUMBER — Left operandCOMPLEX|NUMBER — Right operandReturns: BOOL — True if both real and imaginary parts are equal