Implement all methods for binary division #4

Merged
Rhinemann merged 3 commits from division-implementation into master 2023-07-30 10:25:28 +03:00
2 changed files with 2 additions and 4 deletions
Showing only changes of commit f31491cdad - Show all commits

View File

@ -437,9 +437,9 @@ def binary_division_method_1(first_term: BasicRegister, second_term: BasicRegist
rg2, _ = binary_subtraction_second_complement(rg2, rg1)
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, "RG2 := RG2 - RG1"])))
rg3.left_shift(rg2.memory[0])
rg3.left_shift(not rg2.memory[0])
rg2.left_shift()
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, f"RG3 := l(RG3).RG2[{n+2}]\nRG2 := l(RG2).0"])))
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, f"RG3 := l(RG3).!RG2[{n+2}]\nRG2 := l(RG2).0"])))
return BasicRegister(deque(list(rg3.memory)[1:])), data_table

View File

@ -34,8 +34,6 @@ def input_handler(first_register: bu.BasicRegister, second_register: bu.BasicReg
case "d":
match input("Choose method to use (1-2):\n>>> "):
case "1":
# Warn about development
print("WARNING: this method is still being figured out, wrong results to be expected for now.")
result, data_table = bu.binary_division_method_1(first_register, second_register)
print(f"Division:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
case "2":