[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: ruby equivalent PHP function is_numeric?

Gavin Kistner

11/17/2006 5:47:00 PM

From: Paul Lutus [mailto:nospam@nosite.zzz]
> What purpose does the underscore play? I see that it is
> accepted, I just
> can't figure out why. I have never seen it as part of proper numeric
> syntax, anywhere, in three decades in this business.
>
> a = 1_2_3_4_5_6_7 # => 1234567

big = 10000000
Quick, is that 1e6 or 1e7 or 1e8?

vs.
big = 10_000_000


2 Answers

Paul Lutus

11/17/2006 10:02:00 PM

0

Gavin Kistner wrote:

> From: Paul Lutus [mailto:nospam@nosite.zzz]
>> What purpose does the underscore play? I see that it is
>> accepted, I just
>> can't figure out why. I have never seen it as part of proper numeric
>> syntax, anywhere, in three decades in this business.
>>
>> a = 1_2_3_4_5_6_7 # => 1234567
>
> big = 10000000
> Quick, is that 1e6 or 1e7 or 1e8?
>
> vs.
> big = 10_000_000

You mean, avoid ambiguous locale-specific group separators ",|.", yes?

Interesting. Never saw that before. Plenty of underscores, none of them in
numbers.

--
Paul Lutus
http://www.ara...

Bernard Kenik

11/18/2006 7:01:00 PM

0


----- Original Message -----
From: "Paul Lutus" <nospam@nosite.zzz>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Friday, November 17, 2006 5:05 PM
Subject: Re: ruby equivalent PHP function is_numeric?


> Gavin Kistner wrote:
>
>> From: Paul Lutus [mailto:nospam@nosite.zzz]
>>> What purpose does the underscore play? I see that it is
>>> accepted, I just
>>> can't figure out why. I have never seen it as part of proper numeric
>>> syntax, anywhere, in three decades in this business.
>>>
>>> a = 1_2_3_4_5_6_7 # => 1234567
>>
>> big = 10000000
>> Quick, is that 1e6 or 1e7 or 1e8?
>>
>> vs.
>> big = 10_000_000
>
> You mean, avoid ambiguous locale-specific group separators ",|.", yes?
>
> Interesting. Never saw that before. Plenty of underscores, none of them in
> numbers.
>
> --

I think more for input convenience
x = 10000000 => 10000000
y = 10_000_000 => 10000000
z = 10,000,000 => [10, 0, 0]