aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc/math.h
blob: 813ebf1685def4c70b8320bfe9e4d7851e23cf07 (plain) (blame)
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
// MIT License, Copyright (c) 2020 Marvin Borner

#ifndef MATH_H
#define MATH_H

#include <def.h>

/**
 * Pi constants
 */

#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390

#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962

f32 powf(f32 base, f32 exp);
f64 pow(f64 base, f64 exp);
f32 sqrtf(f32 num);
f64 sqrt(f64 num);

f32 lerpf(f32 from, f32 to, f32 trans);
f64 lerp(f64 from, f64 to, f64 trans);
f32 blerpf(f32 a, f32 b, f32 c, f32 d, f32 transx, f32 transy);
f64 blerp(f64 a, f64 b, f64 c, f64 d, f64 transx, f64 transy);

f32 sinf(f32 angle);
f64 sin(f64 angle);
f32 cosf(f32 angle);
f64 cos(f64 angle);
f32 tanf(f32 angle);
f64 tan(f64 angle);

#endif