Example
0000 0001 Yes0001 0001 NoAlgorithm
Using a bit mask, divide
NUMthe variable in binaryIF R > 0 AND L > 0: Return FALSEOtherwise,
NUMbecomes the one that is non-zeroIF NUM = 1: Return TRUEOtherwise, go to Step 1
Complexity
Time ~ O(log(d)) where d is number of binary digits