forked from pikasTech/PikaPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPikaMath_Math.c
More file actions
82 lines (80 loc) · 2.31 KB
/
PikaMath_Math.c
File metadata and controls
82 lines (80 loc) · 2.31 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "PikaMath_Math.h"
#include <math.h>
#define PI (3.141592653589793115997963468544185161590576171875l)
#define E (2.718281828459045090795598298427648842334747314453125l)
void PikaMath_Math___init__(PikaObj* self) {
obj_setFloat(self, "pi", PI);
obj_setFloat(self, "e", E);
}
pika_float PikaMath_Math_acos(PikaObj* self, pika_float x) {
return acos(x);
}
pika_float PikaMath_Math_asin(PikaObj* self, pika_float x) {
return asin(x);
}
pika_float PikaMath_Math_atan(PikaObj* self, pika_float x) {
return atan(x);
}
pika_float PikaMath_Math_atan2(PikaObj* self, pika_float x, pika_float y) {
return atan2(x, y);
}
int PikaMath_Math_ceil(PikaObj* self, pika_float x) {
return ceil(x);
}
pika_float PikaMath_Math_cos(PikaObj* self, pika_float x) {
return cos(x);
}
pika_float PikaMath_Math_cosh(PikaObj* self, pika_float x) {
return cosh(x);
}
pika_float PikaMath_Math_degrees(PikaObj* self, pika_float x) {
return x * 180.0 / PI;
}
pika_float PikaMath_Math_exp(PikaObj* self, pika_float x) {
return exp(x);
}
pika_float PikaMath_Math_fabs(PikaObj* self, pika_float x) {
return fabs(x);
}
int PikaMath_Math_floor(PikaObj* self, pika_float x) {
return floor(x);
}
pika_float PikaMath_Math_fmod(PikaObj* self, pika_float x, pika_float y) {
return fmod(x, y);
}
pika_float PikaMath_Math_log(PikaObj* self, pika_float x) {
return log(x);
}
pika_float PikaMath_Math_log10(PikaObj* self, pika_float x) {
return log10(x);
}
pika_float PikaMath_Math_log2(PikaObj* self, pika_float x) {
return log2(x);
}
pika_float PikaMath_Math_pow(PikaObj* self, pika_float x, pika_float y) {
return pow(x, y);
}
pika_float PikaMath_Math_radians(PikaObj* self, pika_float x) {
return x * PI / 180.0;
}
pika_float PikaMath_Math_remainder(PikaObj* self, pika_float x, pika_float y) {
return remainder(x, y);
}
pika_float PikaMath_Math_sin(PikaObj* self, pika_float x) {
return sin(x);
}
pika_float PikaMath_Math_sinh(PikaObj* self, pika_float x) {
return sinh(x);
}
pika_float PikaMath_Math_sqrt(PikaObj* self, pika_float x) {
return sqrt(x);
}
pika_float PikaMath_Math_tan(PikaObj* self, pika_float x) {
return tan(x);
}
pika_float PikaMath_Math_tanh(PikaObj* self, pika_float x) {
return tanh(x);
}
pika_float PikaMath_Math_trunc(PikaObj* self, pika_float x) {
return trunc(x);
}