[Python-Dev] Re: [Patches] [Patch #100752] Make atoi work for negative bases, a useful generalization

Alexander D Wissner-Gross alexwg@MIT.EDU
Fri, 7 Jul 2000 09:31:52 -0400 (EDT)


Skip,

Built-in support for negative bases would encourage further use of Python
in math research (specifically, representation theory). For reference,
Mathematica recently added support for negative base conversions.

Negative bases allow the unique representation of both positive and
negative integers without use of a sign. For example, "-3" in decimal 
equals, in base -2, "1101" (-3 = 1*(-2)^3 + 1*(-2)^2 + 0*(-2)^1 + 1*(-2)^0).
It has been suggested that this property makes negative bases a more natural
representation for integers than positive bases. There is more detailed 
information on the subject in The Art of Computer Programming Vol. 2.

This functionality is not already in Python, as someone suggested on
patches@python.org.

Alex