Albedo
Joined 24 August 2022
m
→Binary Digits
m (→Binary Digits) |
m (→Binary Digits) |
||
Line 274:
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, continue at l2) and go through the loop
2X% : n mod 2 (remainder, last binary digit)
2X1X@: move binary digit down, move result of division up
loop is finished, back to the beginning (l1)
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 (
? : pop division result from the stack
l3: N : output first bit: 1 (1*2^1)
|