SPL fully supports complex numbers. SPL defines the constant i to represent . For example:
x = 1 + 2i
y = .5 + i
x + y returns: 1.5 + 3i
x * y returns: 1.5 + 2i
a = {1, 2, 3, 4}
fft(a)
returns a complex series: {10+0i, 2+2i, 2+0i, 22i}
Since i defines a complex number, i cannot be used as a global variable. However, i can be declared as a local variable by using the local declaration:
ilocal(x)
{
local a, i;
for (i = 0; i < x; i++)
{
x * i;
}
return(a, a * 1i);
}
(a, b) = ilocal(10)
a == 90
b == 90i
In this case, DADiSP recognizes i as a local variable and 1i as . The details of the FOR loop will be described shortly.
SPL includes several functions for manipulating complex numbers:
Function 
Description 
Real part of complex number/series 

Imaginary part of a complex number/series 

Magnitude of a complex number/series 

Angle of a complex number/series between π and π 

Angle of a complex number/series between 0 and π 

Complex conjugate of series/number 

Convert from Cartesian to polar form 

Create complex values in real/imaginary form 

Create complex values in magnitude/angle form 
If an operation entails a combination of real and complex numbers, SPL assumes the imaginary part of the real number is zero.