forked from ark-lang/ark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.ark
executable file
·46 lines (39 loc) · 1002 Bytes
/
math.ark
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
PI: f64 = 3.14159265358979323846;
[c] {
func acos(x: f64): f64;
func asin(x: f64): f64;
func atan(x: f64): f64;
func atan2(y: f64, x: f64): f64;
func cos(x: f64): f64;
func cosh(x: f64): f64;
func sin(x: f64): f64;
func sinh(x: f64): f64;
func tanh(x: f64): f64;
func exp(x: f64): f64;
func frexp(x: f64, exponent: ^int): f64;
func ldexp(x: f64, exponent: int): f64;
func log(x: f64): f64;
func log10(x: f64): f64;
func modf(x: f64, integer: ^int): f64;
func pow(x: f64, y: f64): f64;
func sqrt(x: f64): f64;
func ceil(x: f64): f64;
func fabs(x: f64): f64;
func floor(x: f64): f64;
func fmod(x: f64, y: f64): f64;
}
func degToRad(deg: f64): f64 -> deg * 2 * PI / 360.0;
func radToDeg(rad: f64): f64 -> rad / 2 / PI * 360.0;
func log2(x: f64): f64 -> log(x) / log(2);
func max(x: f64, y: f64): f64 {
if x > y {
return x;
}
return y;
}
func min(x: f64, y: f64): f64 {
if x < y {
return x;
}
return y;
}