Zeckendorf arithmetic: Difference between revisions
m
→{{header|Quackery}}: yet another typo
m (→{{header|Quackery}}: another typo) |
m (→{{header|Quackery}}: yet another typo) |
||
Line 3,258:
Subtraction is implemented as ''difference'' (i.e. abs(a-b) as this is an unsigned implementation.) The process is to reduce both numbers in value until the smaller one equals zero. Continuing the naming theme established by <code>canonise</code> and <code>defrock</code>, the word that removes the bits that are set to 1 in both arguments is called <code>exorcise</code>. The appropriate sequence of exorcisms and defrockings will reduce the smaller argument to zero much of the time.
However, numbers which alternate 1s and 0s (e.g. ...01010101...) are immune to both canonisation and defrocking
Division is basic binary long division with a twist; instead of multiplying the divisor by 2 until it's large enough, use it to make a fibonacci style sequence, except starting with a couple of copies of the divisor rather than 1s.
|