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

2009-08-30 Thread Mensanator
On Aug 26, 4:59 pm, Piet van Oostrum p...@cs.uu.nl wrote: Mensanator mensana...@aol.com (M) wrote: M That's my point. Since the common usage of binary is for M Standard Positional Number System of Radix 2, it follows M that unary is the common usage for Standard Positional M Number System of

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

2009-08-30 Thread Steven D'Aprano
On Thu, 27 Aug 2009 10:49:27 -0700, Mensanator wrote: Fine. I'm over it. Point is, I HAVE encountered plenty of people who DON'T properly understand it, Marilyn Vos Savant, for example. I'm curious -- please explain. Links please? You can't blame me for thinking you don't understand it

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

2009-08-30 Thread Piet van Oostrum
Mensanator mensana...@aol.com (M) wrote: M That's my point. Since the common usage of binary is for M Standard Positional Number System of Radix 2, it follows M that unary is the common usage for Standard Positional M Number System of Radix 1. That's VERY confusing since such M a system is

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

2009-08-30 Thread Mel
Mensanator wrote: [ ... ] If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll find that Standard Positional Number Systems are not defined for radix 1. It has to be tweaked. If the only

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

2009-08-27 Thread Mensanator
On Aug 26, 10:27 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Wed, 26 Aug 2009 18:53:04 -0700, Erik Max Francis wrote: In any case, unary is the standard term for what I'm discussing: http://en.wikipedia.org/wiki/Unary_numeral_system snip This really isn't anywhere

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

2009-08-27 Thread Piet van Oostrum
Mensanator mensana...@aol.com (M) wrote: M On Aug 26, 4:59 pm, Piet van Oostrum p...@cs.uu.nl wrote: Mensanator mensana...@aol.com (M) wrote: M That's my point. Since the common usage of binary is for M Standard Positional Number System of Radix 2, it follows M that unary is the common

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

2009-08-27 Thread Mensanator
On Aug 27, 2:26 pm, Piet van Oostrum p...@cs.uu.nl wrote: Mensanator mensana...@aol.com (M) wrote: M On Aug 26, 4:59 pm, Piet van Oostrum p...@cs.uu.nl wrote: Mensanator mensana...@aol.com (M) wrote: M That's my point. Since the common usage of binary is for M Standard Positional Number

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

2009-08-26 Thread Steven D'Aprano
On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two,

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

2009-08-26 Thread Mensanator
On Aug 26, 9:58 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your

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

2009-08-26 Thread Steven D'Aprano
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

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

2009-08-26 Thread Steven D'Aprano
On Thu, 27 Aug 2009 01:34:10 +, Steven D'Aprano wrote: 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

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

2009-08-26 Thread Erik Max Francis
Steven D'Aprano wrote: 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

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

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 18:53:04 -0700, Erik Max Francis wrote: 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. Psst. That's a hint. Googling for unary number system (unary

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

2009-08-25 Thread James Harris
On 25 Aug, 01:25, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: Sure but while I wouldn't normally want to type something as obscure as 32rst into a file of data I might want to type 0xff00 or similar. That is far

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

2009-08-25 Thread Steven D'Aprano
On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll find that Standard Positional Number Systems are not defined for radix 1. Of course

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

2009-08-25 Thread Mensanator
On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll

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

2009-08-25 Thread James Harris
On 24 Aug, 03:49, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: ... Here's another suggested number literal format. First, keep the familar 0x and 0b of C and others and to add 0t for octal. (T is the thirdletter of octal as X is thethirdletter of hex.) The numbers above would be      

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

2009-08-24 Thread Piet van Oostrum
Scott David Daniels scott.dani...@acm.org (SDD) wrote: SDD James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters 0.( begin the sequence. Comments? Improvements? SDD I did a little interpreter where non-base 10 numbers SDD (up to base 36)

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

2009-08-24 Thread Erik Max Francis
MRAB wrote: James Harris wrote: On 23 Aug, 00:16, Mel mwil...@the-wire.com wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from

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

2009-08-24 Thread Erik Max Francis
J. Cliff Dyer wrote: I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. What happens if you use a literal like 0x10f 304? Is 304 treated as decimal or hexadecimal? It's not clear how you would begin to combine it.

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

2009-08-24 Thread James Harris
On 24 Aug, 02:19, Max Erickson maxerick...@gmail.com wrote: ... It can be assumed however that .9. isn't in binary? That's a neat idea. But an even simpler scheme might be: .octal.100 .decimal.100 .hex.100 .binary.100 .trinary.100 until it gets to this anyway:

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

2009-08-24 Thread Hendrik van Rooyen
On Monday 24 August 2009 01:04:37 bartc wrote: That's a neat idea. But an even simpler scheme might be: .octal.100 .decimal.100 .hex.100 .binary.100 .trinary.100 until it gets to this anyway: .thiryseximal.100 Yeah right. So now I first have to type a string, which probably has a

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

2009-08-24 Thread James Harris
On 24 Aug, 09:05, Erik Max Francis m...@alcyone.com wrote: ... Here's another suggested number literal format. First, keep the familar 0x and 0b of C and others and to add 0t for octal. (T is the third letter of octal as X is the third letter of hex.) The numbers above would be  

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

2009-08-24 Thread Erik Max Francis
James Harris wrote: On 24 Aug, 09:05, Erik Max Francis m...@alcyone.com wrote: Here's another suggested number literal format. First, keep the familar 0x and 0b of C and others and to add 0t for octal. (T is the third letter of octal as X is the third letter of hex.) The numbers above would be

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

2009-08-24 Thread Erik Max Francis
James Harris wrote: On 24 Aug, 02:19, Max Erickson maxerick...@gmail.com wrote: It can be assumed however that .9. isn't in binary? That's a neat idea. But an even simpler scheme might be: .octal.100 .decimal.100 .hex.100 .binary.100 .trinary.100 until it gets to this anyway: .thiryseximal.100

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

2009-08-24 Thread Erik Max Francis
Hendrik van Rooyen wrote: I also tried to include an example of a literal with a base of a Googol but I ran out of both ink and symbols. :-) ... or particles in the observable Universe, for that matter. -- Erik Max Francis m...@alcyone.com http://www.alcyone.com/max/ San Jose, CA, USA 37

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

2009-08-24 Thread James Harris
On 24 Aug, 09:30, Erik Max Francis m...@alcyone.com wrote: James Harris wrote: On 24 Aug, 09:05, Erik Max Francis m...@alcyone.com wrote: Here's another suggested number literal format. First, keep the familar 0x and 0b of C and others and to add 0t for octal. (T is the third letter of

Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-24 Thread Carl Banks
On Aug 23, 7:45 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: greg g...@cosc.canterbury.ac.nz writes: J. Cliff Dyer wrote: What happens if you use a literal like 0x10f 304? To me the obvious thing to do is concatenate them textually and then treat the whole thing as a single numeric

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

2009-08-24 Thread NevilleDNZ
On Aug 23, 9:42 pm, James Harris james.harri...@googlemail.com wrote: The numbers above would be 0b1011, 0t7621, 0xc26b Algol68 has the type BITS, that is converted to INT with the ABS operator. The numbers above would be: 2r1011, 8r7621, 16rc26b r is for radix:

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

2009-08-24 Thread Mel
James Harris wrote: On 24 Aug, 02:19, Max Erickson maxerick...@gmail.com wrote: [ ... ] int('100', 3) 9 int('100', 36) 1296 This is fine typed into the language directly but couldn't be entered by the user or read-in from or written to a file. That's rather beside the point. Literals

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

2009-08-24 Thread garabik-news-2005-05
J. Cliff Dyer j...@sdf.lonestar.org wrote: I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. Or, we can use U+00A0 NO-BREAK SPACE, once we already have unicode variable names :-) (probably some people would find it

Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 12:45:25 +1000, Ben Finney wrote: greg g...@cosc.canterbury.ac.nz writes: J. Cliff Dyer wrote: What happens if you use a literal like 0x10f 304? To me the obvious thing to do is concatenate them textually and then treat the whole thing as a single numeric literal.

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

2009-08-24 Thread Scott David Daniels
Piet van Oostrum wrote: Scott David Daniels scott.dani...@acm.org (SDD) wrote: SDD James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters 0.( begin the sequence. Comments? Improvements? SDD I did a little interpreter where non-base 10

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

2009-08-24 Thread James Harris
On 24 Aug, 14:05, Mel mwil...@the-wire.com wrote: James Harris wrote: On 24 Aug, 02:19, Max Erickson maxerick...@gmail.com wrote: [ ... ] int('100', 3) 9 int('100', 36) 1296 This is fine typed into the language directly but couldn't be entered by the user or read-in from or

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

2009-08-24 Thread Steven D'Aprano
On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: Sure but while I wouldn't normally want to type something as obscure as 32rst into a file of data I might want to type 0xff00 or similar. That is far clearer than 65280 in some cases. My point was that int('ff00', 16) is OK for the

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

2009-08-24 Thread Mensanator
On Aug 24, 7:25 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: Sure but while I wouldn't normally want to type something as obscure as 32rst into a file of data I might want to type 0xff00 or similar. That is far

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

2009-08-24 Thread Mensanator
On Aug 24, 8:21�pm, Mel mwil...@the-wire.com wrote: Mensanator wrote: [ ... ] If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll find that Standard Positional Number Systems are not

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

2009-08-23 Thread Dmitry A. Kazakov
On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris wrote: They look good - which is important. The trouble (for me) is that I want the notation for a new programming language and already use these characters. I have underscore as an optional separator for groups of digits - 123000 and

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

2009-08-23 Thread garabik-news-2005-05
In comp.lang.python James Harris james.harri...@googlemail.com wrote: On 22 Aug, 10:27, David 71da...@libero.it wrote: ... What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? They look good - which is important. The trouble (for me) is that I want the notation for a new

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

2009-08-23 Thread Ben Finney
garabik-news-2005...@kassiopeia.juls.savba.sk writes: Why not just use the space? 123 000 looks better than 123_000, and is not syntactically ambiguous (at least in python). And as it already works for string literals, it could be applied to numbers, too… +1 to all this. I think this

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

2009-08-23 Thread J. Cliff Dyer
I had an objection to using spaces in numeric literals last time around and it still stands, and it still stands in the new one. What happens if you use a literal like 0x10f 304? Is 304 treated as decimal or hexadecimal? It's not clear how you would begin to combine it The way string

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

2009-08-23 Thread bartc
garabik-news-2005...@kassiopeia.juls.savba.sk wrote in message news:h6r4fb$18...@aioe.org... In comp.lang.python James Harris james.harri...@googlemail.com wrote: On 22 Aug, 10:27, David 71da...@libero.it wrote: ... What about 2_1011, 8_7621, 16_c26h or 2;1011, 8;7621, 16;c26h ? They

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

2009-08-23 Thread James Harris
On 23 Aug, 04:38, c...@tiac.net (Richard Harter) wrote: On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris james.harri...@googlemail.com wrote: On 22 Aug, 10:27, David 71da...@libero.it wrote: ... (snipped a discussion on languages and other systems interpreting numbers with a

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

2009-08-23 Thread James Harris
On 23 Aug, 00:16, Mel mwil...@the-wire.com wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number   2#1011#, 8#7621#, 16#c26b# Interesting.  They do it because of this example from

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

2009-08-23 Thread James Harris
On 23 Aug, 21:55, James Harris james.harri...@googlemail.com wrote: ...  However for floating point you need at least three letters because a floating point number has three parts: the fixed point point, the exponent base, and the exponent.  Now we can represent the radices of the

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

2009-08-23 Thread MRAB
James Harris wrote: On 23 Aug, 00:16, Mel mwil...@the-wire.com wrote: James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from

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

2009-08-23 Thread Scott David Daniels
James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters 0.( begin the sequence. Comments? Improvements? I did a little interpreter where non-base 10 numbers (up to base 36) were: .7.100 == 64 (octal) .9.100 == 100 (decimal)

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

2009-08-23 Thread bartc
Scott David Daniels scott.dani...@acm.org wrote in message news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... James Harris wrote:... Another option: 0.(2:1011), 0.(8:7621), 0.(16:c26b) where the three characters 0.( begin the sequence. Comments? Improvements? I did a little interpreter

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

2009-08-23 Thread Max Erickson
bartc ba...@freeuk.com wrote: Scott David Daniels scott.dani...@acm.org wrote in message news:kn2dnszr5b0bwazxnz2dnuvz_s-dn...@pdx.net... James Harris wrote:... Another option: It can be assumed however that .9. isn't in binary? That's a neat idea. But an even simpler scheme might

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

2009-08-23 Thread greg
J. Cliff Dyer wrote: What happens if you use a literal like 0x10f 304? To me the obvious thing to do is concatenate them textually and then treat the whole thing as a single numeric literal. Anything else wouldn't be sane, IMO. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

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

2009-08-23 Thread Ben Finney
Max Erickson maxerick...@gmail.com writes: At some point, abandoning direct support for literals and just having a function that can handle different bases starts to make a lot of sense to me: int('100', 8) 64 int('100', 10) 100 int('100', 16) 256 int('100', 2) 4 int('100', 3)

Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-23 Thread Ben Finney
greg g...@cosc.canterbury.ac.nz writes: J. Cliff Dyer wrote: What happens if you use a literal like 0x10f 304? To me the obvious thing to do is concatenate them textually and then treat the whole thing as a single numeric literal. Anything else wouldn't be sane, IMO. Yet, as was pointed

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

2009-08-22 Thread James Harris
On 22 Aug, 10:27, David 71da...@libero.it wrote: ... (snipped a discussion on languages and other systems interpreting numbers with a leading zero as octal) Either hexadecimal should have been 0h or octal should have been 0t :=) I have seen the use of Q/q instead in order to make it

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

2009-08-22 Thread Mel
James Harris wrote: I have no idea why Ada which uses the # also apparently uses it to end a number 2#1011#, 8#7621#, 16#c26b# Interesting. They do it because of this example from http://archive.adaic.com/standards/83rat/html/ratl-02-01.html#2.1: 2#1#E8-- an integer

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

2009-08-22 Thread Richard Harter
On Sat, 22 Aug 2009 14:54:41 -0700 (PDT), James Harris james.harri...@googlemail.com wrote: On 22 Aug, 10:27, David 71da...@libero.it wrote: ... (snipped a discussion on languages and other systems interpreting numbers with a leading zero as octal) Either hexadecimal should have been 0h or