SayoriOS 0.3.3

math.c
1 // Math library by NDRAEY
2
3 #include "lib/math.h"
4
5 size_t fac(size_t x) {
6 size_t a = 1;
7
8 for (size_t i = 1; i < x + 1; i++) {
9 a *= i;
10 }
11
12 return a;
13 }
14
15 size_t ipow(size_t val, size_t exp) {
16 size_t value = val;
17 for (size_t i = 1; i < exp; i++) {
18 value *= val;
19 }
20
21 return value;
22 }
23
24 double deg2rad(double deg) {
25 return deg * (PI / 180.0);
26 }
27
28 double rad2deg(double rad) {
29 return rad * (180.0 / PI);
30 }