Project

General

Profile

Bug #11736 ยป 0001-Improve-documentation-on-Float-Arg.patch

dpulliam (Dylan Pulliam), 02/09/2016 05:51 PM

View differences:

object.c
2986 2986
 *     Float(arg)    -> float
2987 2987
 *
2988 2988
 *  Returns <i>arg</i> converted to a float. Numeric types are converted
2989
 *  directly, the rest are converted using <i>arg</i>.to_f.
2989
 *  directly, and with exception to string and nil the rest are converted using <i>arg</i>.to_f.
2990
 *  Converting a <code>string</code> with invalid characters will result in a <code>ArgumentError</code>.
2990 2991
 *  Converting <code>nil</code> generates a <code>TypeError</code>.
2991 2992
 *
2992
 *     Float(1)           #=> 1.0
2993
 *     Float("123.456")   #=> 123.456
2993
 *     Float(1)                 #=> 1.0
2994
 *     Float("123.456")         #=> 123.456
2995
 *     Float("123.0_badstring") #=> ArgumentError: invalid value for Float(): "123.0_badstring"
2996
 *     Float(nil)               #=> TypeError: can't convert nil into Float
2994 2997
 */
2995 2998

  
2996 2999
static VALUE
2997
-