Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed Jun 1 19:38:15 2016 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Wed Jun 1 19:38:15 2016 +0200
Manual: division algorithm
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/doc/arithmetic.tex b/doc/arithmetic.tex
index e2dd142..4601a7a 100644
_AT_@ -223,7 +223,7 @@ lend you a hand.
Now to the weird ones that will more often than
-not award you a face-slap. % Hade positive punishment
+not award you a face-slap. % Had positive punishment
% been legal or even mildly pedagogical. But I would
% not put it past Coca-Cola.
_AT_@ -306,7 +306,19 @@ not award you a face-slap. % Hade positive punishment
-% TODO zdivmod's algorithm
+Currently, libzahl uses an almost trivial division
+algorithm. It operates on positive numbers. It begins
+by left-shifting the divisor as must as possible with
+letting it exceed the dividend. Then, it subtracts
+the shifted divisor from the dividend and add 1,
+left-shifted as much as the divisor, to the quotient.
+The quotient begins at 0. It then right-shifts
+the shifted divisor as little as possible until
+it no longer exceeds the diminished dividend and
+marks the shift in the quotient. This process is
+repeated on till the unshifted divisor is greater
+than the diminished dividend. The final diminished
+dividend is the remainder.
Received on Wed Jun 01 2016 - 19:38:20 CEST
This archive was generated by hypermail 2.3.0
: Wed Jun 01 2016 - 19:48:19 CEST