Numeric literals in other than base 10 - was Annoying octal notation

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Aug 26 21:34:10 EDT 2009


On Wed, 26 Aug 2009 10:58:12 -0700, Mensanator wrote:

>> But I certainly wouldn't call it "binary", for fear of confusion with
>> radix-2 binary.
> 
> That's my point. Since the common usage of "binary" is for Standard
> Positional Number System of Radix 2, it follows that "unary" is the
> common usage for Standard Positional Number System of Radix 1.

Er, no, that doesn't follow. There is no such thing as a radix-1 
positional number system -- it just doesn't work.

In any case, unary is the standard term for what I'm discussing:

http://en.wikipedia.org/wiki/Unary_numeral_system

although Mathworld doesn't seem to know it.


> That's VERY confusing since such a system is undefined.

Base-1 positional system is defined, it just doesn't work. You would have 
to write a number by the sum of 0*(1**i), which clearly doesn't get you 
very far. Positional unary is only capable of representing zero, and no 
other numbers, which is even less useful than unary, which at least can 
be used for counting positive numbers, addition and subtraction, and even 
has a use in Elias gamma coding.



> Remember, common usage
> does not necessarily properly define things. Saying simply "unary"
> sounds like you're extending common usage beyond its proper boundaries.

You're reasoning by analogy: "binary" means "positional number system 
with radix 2", "decimal" => radix 10, etc, so "unary" => radix 1. That's 
a reasonable heuristic to follow, but it can fail, because even in 
mathematics, names for things don't necessarily follow such patterns 
perfectly. Because the radix 1 positional system can't work and therefore 
doesn't exist, the name "unary" is available, and has been taken to 
describe a number system which counts by tally marks.



-- 
Steven



More information about the Python-list mailing list