axle OS
x86_32 UNIX-like hobby OS
src
std
math.h
1
#ifndef STD_MATH_H
2
#define STD_MATH_H
3
4
#include <stdint.h>
5
#include "std_base.h"
6
#include "sincostan.h"
7
8
__BEGIN_DECLS
9
10
#define CMP(op, a, b) ({ \
11
__typeof__(a) _a = (a); \
12
__typeof__(b) _b = (b); \
13
(_a op _b) ? _a : _b; \
14
})
15
#define MIN(a, b) CMP(<=, a, b)
16
#define MAX(a, b) CMP(>, a, b)
17
18
#define abs(val) ((val) < 0) ? -(val) : (val)
19
20
#define M_PI 3.1415926536
21
#define M_E 2.7182818285
22
23
STDAPI
double
pow(
double
x,
double
pow);
24
STDAPI
unsigned
long
factorial(
unsigned
long
x);
25
26
//trigonometric functions
27
STDAPI
double
cot(
double
val);
28
STDAPI
double
sec(
double
val);
29
STDAPI
double
csc(
double
val);
30
STDAPI
double
exp(
double
x);
31
32
//hyperbolic functions
33
STDAPI
double
sinh(
double
val);
34
STDAPI
double
cosh(
double
val);
35
STDAPI
double
tanh(
double
val);
36
STDAPI
double
coth(
double
val);
37
STDAPI
double
sech(
double
val);
38
STDAPI
double
csch(
double
val);
39
40
//inverse trigonometric functions
41
STDAPI
double
arcsin(
double
val);
42
STDAPI
double
arccos(
double
val);
43
STDAPI
double
arctan(
double
val);
44
STDAPI
double
arccot(
double
val);
45
STDAPI
double
arcsec(
double
val);
46
STDAPI
double
arccsc(
double
val);
47
STDAPI
double
atan2(
double
y,
double
x);
48
49
STDAPI
float
sqrt(
const
float
x);
50
STDAPI
int
round(
double
x);
51
STDAPI
double
floor(
double
x);
52
53
#define RAND_MAX 32767
54
STDAPI uint32_t rand();
55
STDAPI
void
srand(
unsigned
int
seed);
56
57
//linear interpolation
58
STDAPI
float
lerp(
float
a,
float
b,
float
c);
59
60
double
log10(
double
x);
61
double
ln(
double
x);
62
63
__END_DECLS
64
65
#endif // STD_MATH_H
Generated by
1.8.14