Skip to content

Commit

Permalink
Fix division in tests/alu.pir (#122)
Browse files Browse the repository at this point in the history
It was incorrect
  • Loading branch information
lopeetall authored Aug 1, 2023
2 parents 3f1838a + 086d177 commit 45fad88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/alu.pir
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def div_next prev a b m n acc = {
// Shift the divisor
def c = b * (2^n);
// Check if shifting produces larger number
def d = ult m c a;
// Subtract the shifted value if it is smaller
def d = ule m c a;
// Subtract the shifted value if it is smaller or equal
def e = a - d * c;
// Move to the next round on the remainder
prev e b m n (d:acc)
Expand Down Expand Up @@ -245,6 +245,8 @@ def rem n a b = snd (divrem n a b);

(25,21) = divrem 32 3846 153;

(282,0) = divrem 32 282 1;

range 4 15;

def D = 10;

0 comments on commit 45fad88

Please sign in to comment.