amath  1.8.5
Simple command line calculator
mathi.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * Project homepage:
26  * https://amath.innolan.net
27  *
28  */
29 
30 #ifndef AMATH_LIB_COMPLEX_H
31 #define AMATH_LIB_COMPLEX_H
32 
33 #if __GNUC__ > 6
34 #pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
35 #endif
36 
37 /**
38  * @file mathi.h
39  * @brief Complex numbers math library
40  * @details Mostly as specified in [IEEE Std 1003.1, 2013 Edition]:
41  * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
42  */
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef union
49 {
50  double parts[2];
51 } complex;
52 
53 double csgn(complex z);
54 double cabs(complex z);
55 double creal(complex z);
56 double cimag(complex z);
57 double cabs(complex z);
58 complex cpack(double x, double y);
59 complex cadd(complex a, complex z);
60 complex csub(complex a, complex z);
61 complex cmul(complex a, complex z);
62 complex cdiv(complex a, complex z);
63 complex cpow(complex x, complex z);
64 complex cceil(complex z);
65 complex cfloor(complex z);
66 complex ctrunc(complex z);
67 complex cround(complex z);
68 complex creci(complex z);
69 complex conj(complex z);
70 complex cexp(complex z);
71 complex csqrt(complex z);
72 complex ccbrt(complex z);
73 complex clog(complex z);
74 complex clogb(complex z);
75 complex clog10(complex z);
76 complex ccos(complex z);
77 complex csin(complex z);
78 complex ctan(complex z);
79 complex csec(complex z);
80 complex ccsc(complex z);
81 complex ccot(complex z);
82 complex cacos(complex z);
83 complex casin(complex z);
84 complex catan(complex z);
85 complex casec(complex z);
86 complex cacsc(complex z);
87 complex cacot(complex z);
88 complex ccosh(complex z);
89 complex csinh(complex z);
90 complex ctanh(complex z);
91 complex csech(complex z);
92 complex ccsch(complex z);
93 complex ccoth(complex z);
94 complex cacosh(complex z);
95 complex casinh(complex z);
96 complex catanh(complex z);
97 complex casech(complex z);
98 complex cacsch(complex z);
99 complex cacoth(complex z);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif
complex cexp(complex z)
Returns e to the power of a complex number.
Definition: cexp.c:42
complex csech(complex z)
Hyperbolic secant of a complex number.
Definition: csech.c:48
complex ctanh(complex z)
Hyperbolic tangent of a complex number.
Definition: ctanh.c:53
complex ctan(complex z)
Tangent of a complex number.
Definition: ctan.c:55
complex conj(complex z)
Definition: prim.c:59
complex clog(complex z)
Natural logarithm of a complex number.
Definition: clog.c:42
complex csub(complex a, complex z)
Subtraction of two complex numbers.
Definition: prim.c:130
complex casec(complex z)
Inverse secant expressed using complex logarithms:
Definition: casec.c:42
complex cpow(complex x, complex z)
Complex number raised to a power.
Definition: cpow.c:42
complex cround(complex z)
Division of two complex numbers.
Definition: prim.c:110
double creal(complex z)
Real part of complex number.
Definition: prim.c:38
complex cadd(complex a, complex z)
Addition of two complex numbers.
Definition: prim.c:120
complex casinh(complex z)
Inverse hyperbolic sine of complex number.
Definition: casinh.c:47
complex cdiv(complex a, complex z)
Division of two complex numbers.
Definition: prim.c:159
complex clogb(complex z)
Base 2 logarithmic value of complex number.
Definition: clogb.c:41
complex ctrunc(complex z)
Truncated value of complex number.
Definition: prim.c:80
complex clog10(complex z)
Base 10 logarithmic value of complex number.
Definition: clog10.c:41
complex csqrt(complex z)
Square root of complex number.
Definition: csqrt.c:42
complex catanh(complex z)
Inverse hyperbolic tangent of complex number.
Definition: catanh.c:42
complex csinh(complex z)
Hyperbolic sine of a complex number.
Definition: csinh.c:50
complex cacsch(complex z)
Inverse hyperbolic cosecant of complex number.
Definition: cacsch.c:42
double cabs(complex z)
Absolute value of complex number.
Definition: prim.c:54
complex ccosh(complex z)
Hyperbolic cosine of a complex number.
Definition: ccosh.c:48
complex cfloor(complex z)
Floor value of complex number.
Definition: prim.c:90
complex cpack(double x, double y)
Pack two real numbers into a complex number.
Definition: prim.c:68
complex cceil(complex z)
Ceiling value of complex number.
Definition: prim.c:100
complex ccsch(complex z)
Hyperbolic secant of a complex number.
Definition: ccsch.c:48
complex ccsc(complex z)
Cosecant of a complex number.
Definition: ccsc.c:48
double cimag(complex z)
Imaginary part of complex number.
Definition: prim.c:46
complex ccbrt(complex z)
Cube root of complex number.
Definition: ccbrt.c:41
complex cmul(complex a, complex z)
Multiplication of two complex numbers.
Definition: prim.c:140
complex csec(complex z)
Secant of a complex number.
Definition: csec.c:48
complex cacot(complex z)
Inverse cotangent of complex number.
Definition: cacot.c:42
double parts[2]
Definition: mathi.h:50
double csgn(complex z)
Complex signum.
Definition: csgn.c:38
complex ccoth(complex z)
Hyperbolic cotangent of a complex number.
Definition: ccoth.c:50
complex casech(complex z)
Inverse hyperbolic secant of complex numbers.
Definition: casech.c:42
complex ccot(complex z)
Cotangent of a complex number.
Definition: ccot.c:48
complex catan(complex z)
Inverse tangent of complex number.
Definition: catan.c:42
complex cacsc(complex z)
Inverse cosecant of complex number.
Definition: cacsc.c:42
complex casin(complex z)
Inverse sine of complex number.
Definition: casin.c:42
complex cacoth(complex z)
Inverse hyperbolic cotangent of complex number.
Definition: cacoth.c:42
complex cacosh(complex z)
Inverse hyperbolic cosine of complex number.
Definition: cacosh.c:42
complex ccos(complex z)
Cosine of complex number.
Definition: ccos.c:45
complex creci(complex z)
Reciprocal value of complex number.
Definition: prim.c:181
complex cacos(complex z)
Inverse cosine of complex number.
Definition: cacos.c:42
complex csin(complex z)
Sine of a complex number.
Definition: csin.c:50