summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-05 06:41:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-05 06:41:40 +0000
commitef2c92ddf0c008c9bd785491d505afd3c7a73af9 (patch)
treed9b75cbbaf492184b3e02f94392f10caa9897935 /numeric.c
parentc76e698fd8c086930f2b3092b1685d1521d148f4 (diff)
* numeric.c (flo_quo, int_round): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index 09a6ef329d..e16b95c93a 100644
--- a/numeric.c
+++ b/numeric.c
@@ -695,6 +695,13 @@ flo_div(VALUE x, VALUE y)
}
}
+/*
+ * call-seq:
+ * float.quo(numeric) -> float
+ *
+ * Returns float / numeric.
+ */
+
static VALUE
flo_quo(VALUE x, VALUE y)
{
@@ -2259,6 +2266,8 @@ fixdivmod(long x, long y, long *divp, long *modp)
if (modp) *modp = mod;
}
+VALUE rb_big_fdiv(VALUE x, VALUE y);
+
/*
* call-seq:
* fix.fdiv(numeric) -> float
@@ -2271,8 +2280,6 @@ fixdivmod(long x, long y, long *divp, long *modp)
*
*/
-VALUE rb_big_fdiv(VALUE x, VALUE y);
-
static VALUE
fix_fdiv(VALUE x, VALUE y)
{
@@ -3062,6 +3069,19 @@ int_dotimes(VALUE num)
return num;
}
+/*
+ * call-seq:
+ * num.round([ndigits]) -> integer or float
+ *
+ * Rounds <i>flt</i> to a given precision in decimal digits (default 0 digits).
+ * Precision may be negative. Returns a floating point number when +ndigits+
+ * is positive, +self+ for zero, and round down for negative.
+ *
+ * 1.round #=> 1
+ * 1.round(2) #=> 1.0
+ * 15.round(-1) #=> 20
+ */
+
static VALUE
int_round(int argc, VALUE* argv, VALUE num)
{