PatchworkOS
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1#ifndef _MATH_H
2#define _MATH_H 1
3
4#if defined(__cplusplus)
5extern "C"
6{
7#endif
8
9#include "_internal/config.h"
10
11#define M_PI 3.14159265358979323846
12#define M_PI_2 1.57079632679489661923
13#define M_PI_4 0.78539816339744830962
14
15#define HUGE_VALF (1.0f / 0.0f)
16#define HUGE_VAL (1.0 / 0.0)
17#define HUGE_VALL (1.0L / 0.0L)
18
19#define INFINITY (1.0f / 0.0f)
20#define NAN (-(0.0f / 0.0f))
21
22// #define FP_FAST_FMAF
23// #define FP_FAST_FMA
24// #define FP_FAST_FMAL
25
26#define FP_ILOGB0 INT_MIN
27#define FP_ILOGBNAN INT_MAX
28
29#define MATH_ERRNO 1
30#define MATH_ERREXCEPT 2
31
32// I cant be bothered to implement floating point exceptions
33#define math_errhandling (MATH_ERRNO)
34
35#define isfinite(x) __builtin_isfinite(x)
36
37#define isinf(x) __builtin_isinf(x)
38
39#define isnan(x) __builtin_isnan(x)
40
41#define isnormal(x) __builtin_isnormal(x)
42
43#define signbit(x) __builtin_signbit(x)
44
45#define fpclassify(x) __builtin_fpclassify(FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
46
47#define isgreater(x, y) __builtin_isgreater(x, y)
48
49#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
50
51#define isless(x, y) __builtin_isless(x, y)
52
53#define islessequal(x, y) __builtin_islessequal(x, y)
54
55#define islessgreater(x, y) __builtin_islessgreater(x, y)
56
57#define isunordered(x, y) __builtin_isunordered(x, y)
58
59#define FP_INFINITE 1
60#define FP_NAN 2
61#define FP_NORMAL 3
62#define FP_SUBNORMAL 4
63#define FP_ZERO 5
64
65double acos(double x);
66float acosf(float x);
67long double acosl(long double x);
68
69double asin(double x);
70float asinf(float x);
71long double asinl(long double x);
72
73double atan(double x);
74float atanf(float x);
75long double atanl(long double x);
76
77double atan2(double y, double x);
78float atan2f(float y, float x);
79long double atan2l(long double y, long double x);
80
81double cos(double x);
82float cosf(float x);
83long double cosl(long double x);
84
85double sin(double x);
86float sinf(float x);
87long double sinl(long double x);
88
89double tan(double x);
90float tanf(float x);
91long double tanl(long double x);
92
93double acosh(double x);
94float acoshf(float x);
95long double acoshl(long double x);
96
97double asinh(double x);
98float asinhf(float x);
99long double asinhl(long double x);
100
101double atanh(double x);
102float atanhf(float x);
103long double atanhl(long double x);
104
105double cosh(double x);
106float coshf(float x);
107long double coshl(long double x);
108
109double sinh(double x);
110float sinhf(float x);
111long double sinhl(long double x);
112
113double tanh(double x);
114float tanhf(float x);
115long double tanhl(long double x);
116
117double exp(double x);
118float expf(float x);
119long double expl(long double x);
120
121double exp2(double x);
122float exp2f(float x);
123long double exp2l(long double x);
124
125double expm1(double x);
126float expm1f(float x);
127long double expm1l(long double x);
128
129double frexp(double value, int* exp);
130float frexpf(float value, int* exp);
131long double frexpl(long double value, int* exp);
132
133double ilogb(double x);
134float ilogbf(float x);
135long double ilogbl(long double x);
136
137double ldexp(double x, int exp);
138float ldexpf(float x, int exp);
139long double ldexpl(long double x, int exp);
140
141double log(double x);
142float logf(float x);
143long double logl(long double x);
144
145double log10(double x);
146float log10f(float x);
147long double log10l(long double x);
148
149double log1p(double x);
150float log1pf(float x);
151long double log1pl(long double x);
152
153double log2(double x);
154float log2f(float x);
155long double log2l(long double x);
156
157double logb(double x);
158float logbf(float x);
159long double logbl(long double x);
160
161double modf(double value, double* iptr);
162float modff(float value, float* iptr);
163long double modfl(long double value, long double* iptr);
164
165double scalbn(double x, int n);
166float scalbnf(float x, int n);
167long double scalbnl(long double x, int n);
168
169double scalbln(double x, long int* n);
170float scalblnf(float x, long int* n);
171long double scalblnl(long double x, long int* n);
172
173double cbrt(double x);
174float cbrtf(float x);
175long double cbrtl(long double x);
176
177double fabs(double x);
178float fabsf(float x);
179long double fabsl(long double x);
180
181double hypot(double x, double y);
182float hypotf(float x, float y);
183long double hypotl(long double x, long double y);
184
185double pow(double x, double y);
186float powf(float x, float y);
187long double powl(long double x, long double y);
188
189double sqrt(double x);
190float sqrtf(float x);
191long double sqrtl(long double x);
192
193double erf(double x);
194float erff(float x);
195long double erfl(long double x);
196
197double erfc(double x);
198float erfcf(float x);
199long double erfcl(long double x);
200
201double lgamma(double x);
202float lgammaf(float x);
203long double lgammal(long double x);
204
205double tgamma(double x);
206float tgammaf(float x);
207long double tgammal(long double x);
208
209double ceil(double x);
210float ceilf(float x);
211long double ceill(long double x);
212
213double floor(double x);
214float floorf(float x);
215long double floorl(long double x);
216
217double nearbyint(double x);
218float nearbyintf(float x);
219long double nearbyintl(long double x);
220
221double rint(double x);
222float rintf(float x);
223long double rintl(long double x);
224
225long int lrint(double x);
226long int lrintf(float x);
227long int lrintl(long double x);
228long long int llrint(double x);
229long long int llrintf(float x);
230long long int llrintl(long double x);
231
232double round(double x);
233float roundf(float x);
234long double roundl(long double x);
235
236long int lround(double x);
237long int lroundf(float x);
238long int lroundl(long double x);
239long long int llround(double x);
240long long int llroundf(float x);
241long long int llroundl(long double x);
242
243double trunc(double x);
244float truncf(float x);
245long double truncl(long double x);
246
247double fmod(double x, double y);
248float fmodf(float x, float y);
249long double fmodl(long double x, long double y);
250
251double remainder(double x, double y);
252float remainderf(float x, float y);
253long double remainderl(long double x, long double y);
254
255double rmquo(double x, double y);
256float rmquof(float x, float y);
257long double rmquol(long double x, long double y);
258
259double copysign(double x, double y);
260float copysignf(float x, float y);
261long double copysignl(long double x, long double y);
262
263double nan(const char* tagp);
264float nanf(const char* tagp);
265long double nanl(const char* tagp);
266
267double nextafter(double x, double y);
268float nextafterf(float x, float y);
269long double nextafterl(long double x, long double y);
270
271double nexttoward(double x, double y);
272float nexttowardf(float x, float y);
273long double nexttowardl(long double x, long double y);
274
275double fdim(double x, double y);
276float fdimf(float x, float y);
277long double fdiml(long double x, long double y);
278
279double fmax(double x, double y);
280float fmaxf(float x, float y);
281long double fmaxl(long double x, long double y);
282
283double fmin(double x, double y);
284float fminf(float x, float y);
285long double fminl(long double x, long double y);
286
287double fma(double x, double y, double z);
288float fmaf(float x, float y, float z);
289long double fmal(long double x, long double y, long double z);
290
291#if defined(__cplusplus)
292}
293#endif
294
295#endif
long int lroundf(float x)
float frexpf(float value, int *exp)
double scalbn(double x, int n)
double erfc(double x)
float floorf(float x)
float expf(float x)
long double fmaxl(long double x, long double y)
long double acoshl(long double x)
float asinhf(float x)
long int lrintf(float x)
float sinhf(float x)
float ilogbf(float x)
double atan(double x)
Definition atan.c:5
double ceil(double x)
Definition ceil.c:5
long long int llrintl(long double x)
long double floorl(long double x)
long double tanl(long double x)
double modf(double value, double *iptr)
Definition modf.c:5
long double log1pl(long double x)
float tgammaf(float x)
long double powl(long double x, long double y)
long double logbl(long double x)
long int lrint(double x)
long long int llrintf(float x)
double atan2(double y, double x)
Definition atan2.c:4
float scalbnf(float x, int n)
double fmax(double x, double y)
float remainderf(float x, float y)
double cosh(double x)
long double nextafterl(long double x, long double y)
double log2(double x)
long double nexttowardl(long double x, long double y)
float cbrtf(float x)
long double asinl(long double x)
long long int llround(double x)
long double fabsl(long double x)
long double ldexpl(long double x, int exp)
long double exp2l(long double x)
float sqrtf(float x)
float rintf(float x)
float coshf(float x)
long double nearbyintl(long double x)
long double lgammal(long double x)
long double ilogbl(long double x)
long double cbrtl(long double x)
double fmod(double x, double y)
Definition fmod.c:5
double tgamma(double x)
float modff(float value, float *iptr)
long double coshl(long double x)
float nextafterf(float x, float y)
float lgammaf(float x)
long int lround(double x)
float expm1f(float x)
double cos(double x)
Definition cos.c:6
double scalbln(double x, long int *n)
double nearbyint(double x)
float atanhf(float x)
long long int llrint(double x)
long double atanl(long double x)
long double roundl(long double x)
double log10(double x)
long double cosl(long double x)
float tanf(float x)
float logbf(float x)
long double erfl(long double x)
double hypot(double x, double y)
double floor(double x)
Definition floor.c:4
long double expm1l(long double x)
float asinf(float x)
float tanhf(float x)
float log2f(float x)
float cosf(float x)
double round(double x)
Definition round.c:4
float nanf(const char *tagp)
double fdim(double x, double y)
float logf(float x)
long long int llroundf(float x)
double trunc(double x)
Definition trunc.c:3
long long int llroundl(long double x)
float acoshf(float x)
double sinh(double x)
double exp2(double x)
float fmaxf(float x, float y)
long double fminl(long double x, long double y)
float sinf(float x)
long double erfcl(long double x)
double cbrt(double x)
float ceilf(float x)
long double tgammal(long double x)
float scalblnf(float x, long int *n)
long double truncl(long double x)
double fabs(double x)
Definition fabs.c:3
double asinh(double x)
long double hypotl(long double x, long double y)
long double tanhl(long double x)
float acosf(float x)
long double asinhl(long double x)
float fabsf(float x)
double rmquo(double x, double y)
float fminf(float x, float y)
long double sqrtl(long double x)
double ilogb(double x)
float hypotf(float x, float y)
double logb(double x)
long double log2l(long double x)
double tan(double x)
double nan(const char *tagp)
double pow(double x, double y)
float atanf(float x)
float fmaf(float x, float y, float z)
double erf(double x)
float truncf(float x)
long double fmodl(long double x, long double y)
double asin(double x)
long double atan2l(long double y, long double x)
float erff(float x)
float ldexpf(float x, int exp)
double nexttoward(double x, double y)
double sin(double x)
Definition sin.c:6
long double atanhl(long double x)
double ldexp(double x, int exp)
float nearbyintf(float x)
long double rmquol(long double x, long double y)
double sqrt(double x)
long double fdiml(long double x, long double y)
long double remainderl(long double x, long double y)
double nextafter(double x, double y)
double atanh(double x)
double log1p(double x)
long double modfl(long double value, long double *iptr)
float powf(float x, float y)
long int lrintl(long double x)
double fma(double x, double y, double z)
double acosh(double x)
long double nanl(const char *tagp)
float log1pf(float x)
double lgamma(double x)
double frexp(double value, int *exp)
long double sinhl(long double x)
long double scalbnl(long double x, int n)
double copysign(double x, double y)
float erfcf(float x)
double log(double x)
float rmquof(float x, float y)
float roundf(float x)
double exp(double x)
long double ceill(long double x)
double rint(double x)
float log10f(float x)
double expm1(double x)
long double copysignl(long double x, long double y)
float nexttowardf(float x, float y)
long double log10l(long double x)
long double acosl(long double x)
double acos(double x)
long double frexpl(long double value, int *exp)
long double sinl(long double x)
float exp2f(float x)
long double expl(long double x)
long double rintl(long double x)
float fdimf(float x, float y)
long double scalblnl(long double x, long int *n)
double fmin(double x, double y)
float fmodf(float x, float y)
long double fmal(long double x, long double y, long double z)
long double logl(long double x)
double remainder(double x, double y)
float copysignf(float x, float y)
double tanh(double x)
float atan2f(float y, float x)
long int lroundl(long double x)
int64_t x
Definition main.c:152
int64_t y
Definition main.c:153