Morning,

On 9/2/05, Robert Klemme <bob.news / gmx.net> wrote:
> lovebyte2000 / gmail.com wrote:
> > % ff = Kernel.Float("1.0e-309")
> > % puts ff
> >
> > test.rb:3: warning: Float 1.0e-309 out of range

..snip..

> IMHO Float() should raise an exception in these cases; your program will
> never be aware of the conversion error and thus cannot take any action
> against this.  Although this might break some code I'd strongly advocate
> to put an exception in there.  Unfortunaltely this won't help you right
> now...

I'd tend to agree.  Float() is a strict conversion, which is why
Float('bob') raises an exception.

My first thought was "1.0e-309".to_f, but this just produces the same warning. 

Float("bob")    # raise ArgumentError  
"bob".to_f       # no warning, =0

Float('1e-309') # warning but conversion
"1e-309".to_f  # same behavior as Float()

Why would "1.0e-309" (a string without a good numerical float representation) 
work significantly differently than "bob"?  Assuming this is the
desired behavior, it seems inconsistent to my ignorant brain -- can
someone clarify it for me?

Cameron