diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-28 02:30:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-28 02:30:14 +0000 |
commit | 50d6291d864a50a9653d65e8c8b1ab4b310b3e54 (patch) | |
tree | 55020d3fc2dbc989bbf68615fdc92f0c7dfe70f5 /numeric.c | |
parent | ad5be3598032754d758e0ab764d90de0c25f1612 (diff) | |
download | ruby-50d6291d864a50a9653d65e8c8b1ab4b310b3e54.tar.gz |
numeric.c: improves Integer#round rdoc [ci skip]
* numeric.c (int_round): [DOC] improves Integer#round documentation
as well as Float#round.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -5010,7 +5010,7 @@ int_dotimes(VALUE num) /* * Document-method: Integer#round * call-seq: - * int.round([ndigits]) -> integer or float + * int.round([ndigits] [, half: symbol]) -> integer or float * * Rounds +int+ to a given precision in decimal digits (default 0 digits). * @@ -5020,6 +5020,15 @@ int_dotimes(VALUE num) * 1.round #=> 1 * 1.round(2) #=> 1.0 * 15.round(-1) #=> 20 + * + * The <code>half:</code> optional keyword same as Float#round is available. + * + * 25.round(-1, half: :up) #=> 30 + * 25.round(-1, half: :even) #=> 20 + * 25.round(-1, half: :down) #=> 20 + * 35.round(-1, half: :up) #=> 40 + * 35.round(-1, half: :even) #=> 40 + * 35.round(-1, half: :down) #=> 30 */ static VALUE |