Skip to content

Commit aaa542d

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
Doc for some #ceil and #floor
1 parent 78f1b83 commit aaa542d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

numeric.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,10 +2235,6 @@ flo_ndigits(int argc, VALUE *argv)
22352235
* | -4 | 10000 | -20000 |
22362236
* | -5 | 100000 | -100000 |
22372237
* | -6 | 1000000 | -1000000 |
2238-
* | -7 | 10000000 | -10000000 |
2239-
* | -8 | 100000000 | -100000000 |
2240-
* | -9 | 1000000000 | -1000000000 |
2241-
* | -10 | 10000000000 | 0 |
22422238
*
22432239
* Note that the limited precision of floating-point arithmetic
22442240
* may lead to surprising results:
@@ -2744,13 +2740,16 @@ flo_truncate(int argc, VALUE *argv, VALUE num)
27442740

27452741
/*
27462742
* call-seq:
2747-
* floor(digits = 0) -> integer or float
2743+
* floor(ndigits = 0) -> float or integer
27482744
*
2749-
* Returns the largest number that is less than or equal to +self+ with
2750-
* a precision of +digits+ decimal digits.
2745+
* Returns the largest float or integer that is less than or equal to +self+,
2746+
* as specified by the given `ndigits`,
2747+
* which must be an
2748+
* [integer-convertible object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
27512749
*
2752-
* \Numeric implements this by converting +self+ to a Float and
2753-
* invoking Float#floor.
2750+
* Equivalent to <tt>self.to_f.floor(ndigits)</tt>.
2751+
*
2752+
* Related: #ceil, Float#floor.
27542753
*/
27552754

27562755
static VALUE

0 commit comments

Comments
 (0)