D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Integer
/
Filename :
sqrt-c.ri
back
Copy
U:RDoc::AnyMethod[iI" sqrt:ETI"Integer::sqrt;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"FReturns the integer square root of the non-negative integer +n+, ;TI"Iwhich is the largest non-negative integer less than or equal to the ;TI"square root of +numeric+.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I""Integer.sqrt(0) # => 0 ;TI""Integer.sqrt(1) # => 1 ;TI""Integer.sqrt(24) # => 4 ;TI""Integer.sqrt(25) # => 5 ;TI"(Integer.sqrt(10**400) # => 10**200 ;T:@format0o; ; [I"EIf +numeric+ is not an \Integer, it is converted to an \Integer:;T@o;; [ I")Integer.sqrt(Complex(4, 0)) # => 2 ;TI")Integer.sqrt(Rational(4, 1)) # => 2 ;TI")Integer.sqrt(4.0) # => 2 ;TI")Integer.sqrt(3.14159) # => 1 ;T; 0o; ; [I"EThis method is equivalent to <tt>Math.sqrt(numeric).floor</tt>, ;TI"Nexcept that the result of the latter code may differ from the true value ;TI"?due to the limited precision of floating point arithmetic.;T@o;; [I";Integer.sqrt(10**46) # => 100000000000000000000000 ;TI":Math.sqrt(10**46).floor # => 99999999999999991611392 ;T; 0o; ; [I"2Raises an exception if +numeric+ is negative.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&Integer.sqrt(numeric) -> integer ;T0[ I" (p1);T@-FI"Integer;TcRDoc::NormalClass00