-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bc
49 lines (45 loc) · 990 Bytes
/
.bc
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
# Trig
pi = 4*a(1)
define deg(x) { return 180*x/pi }
define rad(x) { return pi*x/180 }
define t(x) { return s(x)/c(x) }
define sin(x) { return s(x) }
define sind(x) { return s(rad(x)) }
define cos(x) { return c(x) }
define cosd(x) { return c(rad(x)) }
define tan(x) { return t(x) }
define tand(x) { return t(rad(x)) }
define atan(x) { return a(x) }
define atand(x) { return deg(a(x)) }
define asin(x) {
if (x == 1) {
ans = pi/2
} else {
if (x == -1) {
ans = -pi/2
} else {
ans = a(x/sqrt(1 - x^2))
}
}
return ans
}
define asind(x) { return deg(asin(x)) }
define acos(x) {
if (x == 0 ) {
ans = pi/2
} else {
if (x > 0) {
ans = a(sqrt(1 - x^2)/x)
} else {
ans = a(sqrt(1 - x^2)/x) + pi
}
}
return ans
}
define acosd(x) { return deg(acos(x)) }
# Exponential
define exp(x) { return e(x) }
define log(x) { return l(x) }
define ln(x) { return l(x) }
define log10(x) { return l(x)/l(10) }
define log2(x) { return l(x)/l(2) }