forked from ThomasTheSpaceFox/libbaltcalc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest1.py
More file actions
executable file
·30 lines (28 loc) · 803 Bytes
/
test1.py
File metadata and controls
executable file
·30 lines (28 loc) · 803 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
#!/usr/bin/env python
import libbaltcalc as btcalc
from libbaltcalc import btint
#you can pass a string with balanced ternary integers and even a btint instance.
int1=btint("+-")
int2=btint("+-")
#max positive integer of a length of trits
print(btcalc.mpi(6))
#max negative integer of a length of trits
print(btcalc.mni(6))
#max combinations value of a length of trits
print(btcalc.mcv(6))
#seamless balanced ternary integer mathematics makes coding easier and more clean.
print(int1 + int2)
print(int1)
print(int2)
#mathematics operations return btint instances.
int3=( - int1)
print(int3)
print(abs(int3))
#the int() method is also supported.
print(int(int3))
print("div")
print((int1 // int2))
print(((int1 + int2) // int2))
#you can also pass decimal integers
print(btint(585))
print(btint(-585))