-
Notifications
You must be signed in to change notification settings - Fork 1
/
tablegen2.py
executable file
·57 lines (52 loc) · 1.32 KB
/
tablegen2.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
#!/usr/bin/env python
#test script for libbaltcalc's addition function.
import libbaltcalc
import math
#padding table
def pad9(inpnum):
padcnt=0
for f in inpnum:
padcnt +=1
if padcnt==0:
return("000000000" + inpnum)
if padcnt==1:
return("00000000" + inpnum)
if padcnt==2:
return("0000000" + inpnum)
if padcnt==3:
return("000000" + inpnum)
if padcnt==4:
return("00000" + inpnum)
if padcnt==5:
return("0000" + inpnum)
if padcnt==6:
return("000" + inpnum)
if padcnt==7:
return("00" + inpnum)
if padcnt==8:
return("0" + inpnum)
if padcnt==9:
return(inpnum)
def btestpos(decnumtocountto):
decicnt=0
decnumtocountto += 1
prevbtnum="0"
print("actual decimal count| BT count in decimal | BT count")
while decicnt!=decnumtocountto:
print (pad9(prevbtnum))
#print (str(decicnt) + "|" + str(libbaltcalc.BTTODEC(prevbtnum)) + "|" + prevbtnum)
prevbtnum=(libbaltcalc.btadd(prevbtnum, "+"))
decicnt += 1
def btestneg(decnumtocountto):
decicnt=0
decnumtocountto -= 1
prevbtnum="0"
print("actual decimal count| BT count in decimal | BT count")
while decicnt!=decnumtocountto:
print (pad9(prevbtnum))
#print (str(decicnt) + "|" + str(libbaltcalc.BTTODEC(prevbtnum)) + "|" + prevbtnum)
prevbtnum=(libbaltcalc.btadd(prevbtnum, "-"))
decicnt -= 1
btestneg(-9841)
#print("000000000")
#btestpos(9841)