ruby-changes:44348
From: hsbt <ko1@a...>
Date: Fri, 14 Oct 2016 18:27:35 +0900 (JST)
Subject: [ruby-changes:44348] hsbt:r56421 (trunk): * object.c: Improve documentation for Integer conversion.
hsbt 2016-10-14 18:27:23 +0900 (Fri, 14 Oct 2016) New Revision: 56421 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56421 Log: * object.c: Improve documentation for Integer conversion. [ruby-core:71661][Bug #11736][ci skip] Modified files: trunk/ChangeLog trunk/object.c Index: ChangeLog =================================================================== --- ChangeLog (revision 56420) +++ ChangeLog (revision 56421) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Oct 14 18:27:18 2016 SHIBATA Hiroshi <hsbt@r...> + + * object.c: Improve documentation for Integer conversion. + [ruby-core:71661][Bug #11736][ci skip] + Fri Oct 14 18:00:20 2016 SHIBATA Hiroshi <hsbt@r...> * lib/logger.rb: Improve Logger.new option documentation. Index: object.c =================================================================== --- object.c (revision 56420) +++ object.c (revision 56421) @@ -2968,11 +2968,14 @@ FUNC_MINIMIZED(static VALUE rb_f_float(V https://github.com/ruby/ruby/blob/trunk/object.c#L2968 * Float(arg) -> float * * Returns <i>arg</i> converted to a float. Numeric types are converted - * directly, the rest are converted using <i>arg</i>.to_f. + * directly, and with exception to string and nil the rest are converted using <i>arg</i>.to_f. + * Converting a <code>string</code> with invalid characters will result in a <code>ArgumentError</code>. * Converting <code>nil</code> generates a <code>TypeError</code>. * - * 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/