-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathinf_calc.py
More file actions
53 lines (36 loc) · 691 Bytes
/
inf_calc.py
File metadata and controls
53 lines (36 loc) · 691 Bytes
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
print(float('inf') + 100)
# inf
print(float('inf') + float('inf'))
# inf
print(float('inf') - 100)
# inf
print(float('inf') - float('inf'))
# nan
print(type(float('inf') - float('inf')))
# <class 'float'>
print(float('inf') * 2)
# inf
print(float('inf') * float('inf'))
# inf
print(float('inf') * 0)
# nan
print(float('inf') / 2)
# inf
print(float('inf') / float('inf'))
# nan
print(0 / float('inf'))
# 0.0
# print(float('inf') / 0)
# ZeroDivisionError: float division by zero
print(float('inf') ** 2)
# inf
print(float('inf') ** float('inf'))
# inf
print(float('inf') ** 0)
# 1.0
print(2 ** float('inf'))
# inf
print(1 ** float('inf'))
# 1.0
print(0 ** float('inf'))
# 0.0