DADiSP Worksheet Functions > Function Categories > Data Type Conversion > CASTCOMPLEX

 

CASTCOMPLEX

Purpose:

Explicitly casts the input to a complex scalar.

Syntax:

CASTCOMPLEX(val)

val

-

A scalar, series or table.

Returns:

A complex number. If the imaginary part of the complex value is zero, only the real part is returned.

Example:

W1: gline(10,1,.5,.2) + i*gline(10,1,.5,8)

castcomplex(W1)

 

returns the value 0.2 + 8i.

Example:

iscomplex(castcomplex(1.0))

 

returns 1

Remarks:

CASTCOMPLEX is helpful when writing SPL functions that require an explicit complex input and the type of the variable passed into the function may not be complex.

 

If the input to CASTCOMPLEX is a series, it will only operate on the first point of the series.

 

If the input to CASTCOMPLEX is a table, it will only operate on the first point in the first column of the table.

See Also:

CASTINTEGER

CASTREAL

CASTSERIES

CASTSTRING

CASTWINDOW

COMPLEX

ISCOMPLEX

MAKECARTESIAN