summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-27 07:27:20 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-27 07:27:20 +0000
commit331fea278b05d4ef32c271d000192288f505f494 (patch)
tree33fafe9f5f754a287495eed6bb706c9e644f9252 /object.c
parenta5b3244d89d55c2b3556e191d12eb2e1b7648340 (diff)
merge revision(s) 56421,56422: [Backport #11736]
* object.c: Improve documentation for Integer conversion. [ruby-core:71661][Bug #11736][ci skip] * object.c: Improve documentation for Float conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/object.c b/object.c
index fe7b6f9be8..1addc92717 100644
--- a/object.c
+++ b/object.c
@@ -2953,11 +2953,14 @@ rb_Float(VALUE val)
* 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