-
Notifications
You must be signed in to change notification settings - Fork 1
/
complex.h
65 lines (52 loc) · 1.66 KB
/
complex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct complex_t
{
long double real;
long double imag;
} complex_t;
#if !defined(_COMPLEX_H_) && !defined(complex) && !defined(__cplusplus)
typedef complex_t complex;
#endif
/* Various library functions */
long double real(complex_t num);
long double imag(complex_t num);
complex_t cvalue(long double real, long double imag);
char *ctoa(complex_t num);
/* Angle conversion functions */
long double degtorad(long double deg);
long double radtodeg(long double rad);
/* Basic complex number functions */
long double cabs(complex_t num);
long double carg(complex_t num);
complex_t conj(complex_t num);
/* Elementary operations */
complex_t cadd(complex_t num1, complex_t num2);
complex_t cdiff(complex_t num1, complex_t num2);
complex_t cmultiply(complex_t num1, complex_t num2);
complex_t cdivide(complex_t num1, complex_t num2);
/* Trigonometry */
complex_t csin(complex_t num);
complex_t ccos(complex_t num);
complex_t ctan(complex_t num);
complex_t ccsc(complex_t num);
complex_t csec(complex_t num);
complex_t ccot(complex_t num);
/* Hyperbolic trigonometry */
complex_t csinh(complex_t num);
complex_t ccosh(complex_t num);
complex_t ctanh(complex_t num);
complex_t ccsch(complex_t num);
complex_t csech(complex_t num);
complex_t ccoth(complex_t num);
/* Powers */
complex_t cexp(complex_t num);
complex_t cpower(complex_t num, complex_t power);
complex_t csqrt(complex_t num);
/* Logarithms */
complex_t clog(complex_t num);
complex_t clogbase(complex_t base, complex_t num);
complex_t clog10(complex_t num);
#include "complex.c"