John Machin <sjmac...@lexicon.net> writes: > 3 can be represented in 2 bits and at the same time -3 can be > represented in 2 bits?? But 2 bits can support only 2 ** 2 == 4 > different possibilities, and -3 .. 3 is 7 different integers.
Yeah, I made some arbitrary choices about what to do with non-positive inputs. If you prefer other answers, use 'em. My ones work well with signed-magnitude representations where the sign is stored separately. >> ## Find upper bound of the form 2^(2^n) >= x. > > Possibly you mean 2 ** ( 2 ** n) >= x I write maths in comments, not Python. Feel lucky I didn't write it in LaTeX. -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list