From c4ca249090ba6b17a8d172e72632827e1e8e339b Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 14 Oct 2016 09:27:23 +0000 Subject: * object.c: Improve documentation for Integer conversion. [ruby-core:71661][Bug #11736][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'object.c') diff --git a/object.c b/object.c index 451746150d..9769c1ee26 100644 --- a/object.c +++ b/object.c @@ -2968,11 +2968,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 -- cgit v1.2.3