User:Albedo: Difference between revisions

Content added Content deleted
Line 273: Line 273:
l1: = : duplicate number
l1: = : duplicate number
2X/= : divide n by 2 and duplicate the result
2X/= : divide n by 2 and duplicate the result
1X!>#: is the result >0? (is n>=2?) It is, thus rotate the pointer by 1 (downwards, l2) and go through the loop
1X!>#: is the result >0? (is n>=2?) It is, thus rotate the pointer by 1 (downwards, continue at l2) and go through the loop
2X1X@: move the result down (needed for further processing), and move n to the top of the stack
2X1X@: move the result down (needed for further processing), and move n to the top of the stack
2X% : n mod 2 (remainder, last binary digit)
2X% : n mod 2 (remainder, last binary digit)
2X1X@: move binary digit down, move result of division up
2X1X@: move binary digit down, move result of division up
loop is finished, back to the beginning (l1)
loop is finished, back to the beginning (l1)
l1: = : duplicate result of division
l2: = : duplicate result of division
2X/= : divide n by 2 and duplicate the result
2X/= : divide n by 2 and duplicate the result
1X!>#: is the result >0? (is n>=2?) It is not, thus don’t rotate the pointer and move on (to l3)
1X!>#: is the result >0? (is n>=2?) It is not, thus don’t rotate the pointer and move on (to l3)