From 4fde48e4e15770f8f99e7fa8daf538068e4eef7b Mon Sep 17 00:00:00 2001 From: Dylan Pulliam Date: Tue, 9 Feb 2016 12:50:45 -0500 Subject: [PATCH] Improve documentation on Float(Arg) --- object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/object.c b/object.c index 910fb4e..4fca732 100644 --- a/object.c +++ b/object.c @@ -2986,11 +2986,14 @@ FUNC_MINIMIZED(static VALUE rb_f_float(VALUE obj, VALUE arg)); * Float(arg) -> float * * Returns arg converted to a float. Numeric types are converted - * directly, the rest are converted using arg.to_f. + * directly, and with exception to string and nil the rest are converted using arg.to_f. + * Converting a string with invalid characters will result in a ArgumentError. * Converting nil generates a TypeError. * - * Float(1) #=> 1.0 - * Float("123.456") #=> 123.456 + * Float(1) #=> 1.0 + * Float("123.456") #=> 123.456 + * Float("123.0_badstring") #=> ArgumentError: invalid value for Float(): "123.0_badstring" + * Float(nil) #=> TypeError: can't convert nil into Float */ static VALUE -- 2.3.4