amath  1.8.5
Simple command line calculator
mathr.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_REAL_H
31 #define AMATH_LIB_REAL_H
32 
33 /**
34  * @file mathr.h
35  * @brief Real numbers math library
36  * @details The library is based on fdlib by Sun Microsystems.
37  *
38  * The original library can be downloaded at netlib.org:<BR>
39  * http://www.netlib.org/fdlibm/
40  *
41  * or from mirror site hensa.ac.uk:<BR>
42  * http://www.hensa.ac.uk/
43  *
44  * More info on double precision floating point at Wikipedia:<BR>
45  * https://wikipedia.org/wiki/Double-precision_floating-point_format
46  * @author Carsten Sonne Larsen <cs@innolan.net>
47  */
48 
49 #define PI 3.1415926535897932384626433832795028841971693994
50 #define EULERS 2.7182818284590452353602874713526624977572470937
51 #define INFP 0x7FF0000000000000ull
52 #define INFN 0xFFF0000000000000ull
53 #define NAN 0x7FFFFFFFFFFFFFFFull
54 #define sgn(x) (x > 0 ? 1 : x < 0 ? -1 : 0)
55 #define abs(x) (x > 0 ? x : -x)
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 double fabs(double x);
62 double ceil(double x);
63 double floor(double x);
64 double round(double x);
65 double trunc(double x);
66 double exp(double x);
67 double sqrt(double x);
68 double cbrt(double x);
69 double log(double x);
70 double log10(double x);
71 
72 double cos(double x);
73 double sin(double x);
74 double tan(double x);
75 double sec(double x);
76 double csc(double x);
77 double cot(double x);
78 double exs(double x);
79 double exc(double x);
80 double crd(double x);
81 double acos(double x);
82 double asin(double x);
83 double atan(double x);
84 double asec(double x);
85 double acsc(double x);
86 double acot(double x);
87 double aexs(double x);
88 double aexc(double x);
89 double acrd(double x);
90 
91 double cosh(double x);
92 double sinh(double x);
93 double tanh(double x);
94 double sech(double x);
95 double csch(double x);
96 double coth(double x);
97 double acosh(double x);
98 double asinh(double x);
99 double atanh(double x);
100 double asech(double x);
101 double acsch(double x);
102 double acoth(double x);
103 
104 double ver(double x);
105 double vcs(double x);
106 double cvs(double x);
107 double cvc(double x);
108 double hv(double x);
109 double hvc(double x);
110 double hcv(double x);
111 double hcc(double x);
112 double aver(double x);
113 double avcs(double x);
114 double acvs(double x);
115 double acvc(double x);
116 double ahv(double x);
117 double ahvc(double x);
118 double ahcv(double x);
119 double ahcc(double x);
120 
121 double pow(double x, double y);
122 double fmod(double x, double y);
123 double atan2(double y, double x);
124 double hypot(double x, double y);
125 double log2p(double x, double y);
126 double log1p(double x);
127 double expm1(double x);
128 double scalbn(double x, int n);
129 double copysign(double x, double y);
130 int rempio2(double x, double* y);
131 unsigned int log2i(unsigned int x);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif
double sech(double x)
Hyperbolic secant function.
Definition: sech.c:44
double hcc(double x)
Hacoversed cosine function.
Definition: hcc.c:44
double ahcc(double x)
Inverse hacoversed cosine.
Definition: ahcc.c:40
double cvs(double x)
Coversed sine function.
Definition: cvs.c:44
double acvs(double x)
Inverse coversed sine function.
Definition: acvs.c:40
double acot(double x)
Inverse cotangent function.
Definition: acot.c:45
double exc(double x)
Excosecant function.
Definition: exc.c:47
double ver(double x)
Versed sine function.
Definition: ver.c:45
double hv(double x)
Haversed sine function.
Definition: hv.c:44
double crd(double x)
Chord function.
Definition: crd.c:44
double acsch(double x)
Inverse hyperbolic cosecant function.
Definition: acsch.c:49
double cot(double x)
Cotangent function.
Definition: cot.c:47
double asech(double x)
Inverse hyperbolic secant function.
Definition: asech.c:52
double csch(double x)
Hyperbolic cosecant function.
Definition: csch.c:44
double sec(double x)
Secant function.
Definition: sec.c:45
double ahvc(double x)
Inverse haversed cosine.
Definition: ahvc.c:40
double coth(double x)
Hyperbolic cotangent function.
Definition: coth.c:44
unsigned int log2i(unsigned int x)
double acsc(double x)
Inverse cosecant function.
Definition: acsc.c:45
double asec(double x)
Inverse secant function.
Definition: asec.c:45
double acrd(double x)
Inverse chord function.
Definition: acrd.c:45
double aexc(double x)
Inverse excosecant function.
Definition: aexc.c:46
double log2p(double x, double y)
Definition: log2p.c:32
double acoth(double x)
Inverse hyperbolic cotangent function.
Definition: acoth.c:49
double acvc(double x)
Inverse versed cosine.
Definition: acvc.c:45
double aexs(double x)
Inverse exsecant function.
Definition: aexs.c:47
double aver(double x)
Inverse versed sine function.
Definition: aver.c:40
double hvc(double x)
Haversed cosine function.
Definition: hvc.c:44
double vcs(double x)
Versed cosine function.
Definition: vcs.c:45
double hcv(double x)
Hacoversed sine function.
Definition: hcv.c:44
double avcs(double x)
Inverse versed sine.
Definition: avcs.c:44
int32_t rempio2(double x, double *y)
Definition: remp2.c:104
double cvc(double x)
Coversed cosine function.
Definition: cvc.c:44
double csc(double x)
Cosecant function.
Definition: csc.c:45
double ahv(double x)
Inverse haversed sine.
Definition: ahv.c:40
double exs(double x)
Exsecant function.
Definition: exs.c:48
double ahcv(double x)
Inverse hacoversed sine.
Definition: ahcv.c:40