# 3.1 Floating Point Complex

There are 3 floating point complex types: `fcomplex`, `dcomplex` and `lcomplex` corresponding to `float`, `double`, and {long double} real numbers. The mapping is to these C++ types:

```  Felix name    Alias              C name
-----------------------------------------------------------
fcomplex      complex[float]    ::std::complex<float>
dcomplex      complex[double]   ::std::complex<double>
lcomplex      complex[ldouble]  ::std::complex<long double>
```

## 3.1.1 Functions

Complex floats can be compared for equality, however there are no other comparisons because there is no canonical way to order them.

Complex floats support these base functions:

```  neg: t -> t;
add: t * t -> t;
sub: t * t -> t;
mul: t * t -> t;
div: t * t -> t;
```

and these trigonometric functions:

```  sin: t -> t;
cos: t -> t;
tan: t -> t;
asin: t -> t;
acos: t -> t;
atan: t -> t;
sinh: t -> t;
cosh: t -> t;
tanh: t -> t;
asinh: t -> t;
acosh: t -> t;
atanh: t -> t;
exp: t -> t;
log: t -> t;
pow: t * t -> t;
```

### 3.1.1.1 Complex constructors

Complex numbers do not have literals, instead they have constructors. A complex number of any type can be constructed from one real of any type, or two reals of the same type, this being the Cartesian form.

```  val z = dcomplex (1.0,2.0);
```

### 3.1.1.2 Complex functions

In addition to the base and trigonometric functions, complex numbers support these functions:

```  // destructors
real: t -> r;
imag: t -> r;
abs: t -> r;
arg: t -> r;

// mixed complex and real operations
add: r * t -> t;
add: t * r -> t;
sub: r * t -> t;
sub: t * r -> t;
mul : t * r -> t;
mul : r * t -> t;
div : t * r -> t;
div : r * t -> t;
```

where `r` is the real type corresponding to the complex type `t`.