-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_posit16_test_values.py
55 lines (51 loc) · 1.72 KB
/
create_posit16_test_values.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
import random
import sys
random.seed(0)
n = 1000000
with open('posit_input.txt', 'w') as posit_input:
# 0 + 0
posit_input.write('0000000000000000\n')
posit_input.write('0000000000000000\n')
# 0 + inf
posit_input.write('0000000000000000\n')
posit_input.write('1000000000000000\n')
# inf + 0
posit_input.write('1000000000000000\n')
posit_input.write('0000000000000000\n')
# inf + inf
posit_input.write('1000000000000000\n')
posit_input.write('1000000000000000\n')
# max_num + max_num
posit_input.write('0111111111111111\n')
posit_input.write('0111111111111111\n')
# 1 + (-1)
posit_input.write('0100000000000000\n')
posit_input.write('1100000000000000\n')
# (-1) + 1
posit_input.write('1100000000000000\n')
posit_input.write('0100000000000000\n')
# min_num + min_num
posit_input.write('1000000000000001\n')
posit_input.write('1000000000000001\n')
# large_num + small_num
posit_input.write('0111111111110000\n')
posit_input.write('0000000000000001\n')
# large_num + small_neg_num
posit_input.write('0111111111110000\n')
posit_input.write('1111111111111110\n')
# 0 + rand_num
posit_input.write('0000000000000000\n')
posit_input.write('0000110001001011\n')
# 0 + (-rand_num)
posit_input.write('0000000000000000\n')
posit_input.write('1000001001001000\n')
# rand_num + 0
posit_input.write('0000110001001011\n')
posit_input.write('0000000000000000\n')
# (-rand_num) + 0
posit_input.write('1000001001001000\n')
posit_input.write('0000000000000000\n')
for _ in range(n * 2):
for _ in range(16):
posit_input.write(str(random.randint(0, 1)))
posit_input.write('\n')