summaryrefslogtreecommitdiff
path: root/lib/libm/ccos.c
blob: 331c5c49e3e02d24335b415c214a4a9a93de2926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "__complex.h" // for cchsh

#include <complex.h> // for creal, ccos, cimag, complex, I
#include <math.h>    // for cos, sin

double complex ccos(double complex z)
{
	double ch, sh;

	cchsh(cimag(z), &ch, &sh);

	return cos(creal(z)) * ch - (sin(creal(z)) * sh) * I;
}