complex

Syntax

complex(X, Y)

Details

Create a complex number X+Y*i.

The length of a complex number is 16 bytes. The low 8 bytes are stored in X, and the high 8 bytes are stored in Y.

Parameters

X and Y are numeric scalars, pairs, vectors or matrices. They can be of Integral (excluding compress and INT128) or Floating type.

Returns

A scalar, vector, or matrix of type COMPLEX.

Examples

complex(2, 5)
// output: 2.0+5.0i

a=1.0 2.3
b=3 4
complex(a,b)

// output:[1+3i,2.3+4i]

x=matrix([1,2], [3,4], [5,6])
complex(x, 0)
#0 #1 #2
1+0i 3+0i 5+0i
2+0i 4+0i 6+0i

Related functions: highDouble, lowDouble