-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_math_logic_operators.py
87 lines (70 loc) · 1.5 KB
/
add_math_logic_operators.py
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
83
84
85
86
87
import operator
import math
def int_from_float(a):
if a is not None:
return operator.floordiv(a, 1)
else:
return None
def qudric(a):
if a is None:
return None
return operator.pow(a, 2)
def start_solving(something):
print('= in expression')
return None
def unary_minus(a):
if a is None:
return None
return -a
def sin(a):
if a is None:
return None
a = math.radians(a)
return math.sin(a)
def cos(a):
if a is None:
return None
a = math.radians(a)
return math.cos(a)
def tan(a):
if a is None:
return None
a = math.radians(a)
return math.tan(a)
def atan(a):
if a is None:
return None
a = math.atan(a)
return math.degrees(a)
def arccos(a):
if a is None:
return None
a = math.acos(a)
return math.degrees(a)
def arcsin(a):
if a is None:
return None
a = math.asin(a)
return math.degrees(a)
def divide(a, b):
if b != 0:# and a is not None and b is not None:
return operator.truediv(a, b)
else:
print('None or infinity')
return None
#def multy(a, b):
# if a is None or b is None:
# return None
# return operator.mul
#def sum_(a, b):
# if a is None or b is None:
# return None
# return operator.add
#def sub_(a, b):
# if a is None or b is None:
# return None
# return operator.sub
def pow_(a, b):
if a is None or b is None:
return None
return operator.pow(a, b)