From: nobu@... Date: 2017-02-25T06:52:29+00:00 Subject: [ruby-core:79769] [Ruby trunk Bug#13251][Assigned] [DOC] Add rdoc for Integer.sqrt Issue #13251 has been updated by Nobuyoshi Nakada. Status changed from Open to Assigned Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONTNEED Thank you, feel free to add it. I was writing it too, but you'll make better one. This is my draft, FYI. ```diff diff --git c/NEWS i/NEWS index 2a0413f006..8647e5e2ce 100644 --- c/NEWS +++ i/NEWS @@ -21,4 +21,8 @@ with all sufficient information, see the ChangeLog file or Redmine === Core classes updates (outstanding ones only) +* Integer + + * Integer.sqrt [Feature #13219] + * Regexp * Update Onigmo 6.1.1. Modified numeric.c diff --git c/numeric.c i/numeric.c index b34fb0a5f9..c827a8c7c9 100644 --- c/numeric.c +++ i/numeric.c @@ -5155,4 +5155,22 @@ DEFINE_INT_SQRT(BDIGIT, rb_bdigit_dbl, BDIGIT_DBL) VALUE rb_big_isqrt(VALUE); +/* + * call-seq: + * Integer.sqrt(x) -> Integer + * + * Returns the largest integer which does not exceed the non-negative + * square root of _x_. Equivalent to `Math.sqrt(x).floor`, except + * for that the result of the latter code may be greater than the + * true root when _x_ exceeds the Float precision. + * + * If _x_ is not an Integer, it is converted to an Integer first. + * If _x_ is negative, a Math::DomainError is raised, as well as + * Math.sqrt. + * + * Integer.sqrt(0) #=> 0 + * Integer.sqrt(1) #=> 1 + * Integer.sqrt(10) #=> 3 + * Integer.sqrt(10**400) #=> 10**200 + */ static VALUE rb_int_s_isqrt(VALUE self, VALUE num) ``` ---------------------------------------- Bug #13251: [DOC] Add rdoc for Integer.sqrt https://bugs.ruby-lang.org/issues/13251#change-63195 * Author: Marcus Stollsteimer * Status: Assigned * Priority: Normal * Assignee: Marcus Stollsteimer * Target version: * ruby -v: ruby 2.5.0dev (2017-02-24 trunk 57707) [x86_64-linux] * Backport: 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONTNEED ---------------------------------------- Nobu, I would offer to add documentation for Integer.sqrt, feature #13219 (r57705). I'd like to prepare a patch and eventually try to commit it myself. I'm not sure yet when to open issues for documentation and when to simply commit; I would be glad about any feedback. -- https://bugs.ruby-lang.org/ Unsubscribe: