D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Numeric
/
Filename :
modulo-i.ri
back
Copy
U:RDoc::AnyMethod[iI"modulo:ETI"Numeric#modulo;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"4Returns +self+ modulo +other+ as a real number.;To:RDoc::Markup::BlankLine o; ; [I"/Of the Core and Standard Library classes, ;TI",only Rational uses this implementation.;T@o; ; [I"LFor Rational +r+ and real number +n+, these expressions are equivalent:;T@o:RDoc::Markup::Verbatim; [I"r % n ;TI"r-n*(r/n).floor ;TI"r.divmod(n)[1] ;T:@format0o; ; [I"See Numeric#divmod.;T@o; ; [I"Examples:;T@o;; [I"&r = Rational(1, 2) # => (1/2) ;TI"&r2 = Rational(2, 3) # => (2/3) ;TI"&r % r2 # => (1/2) ;TI"&r % 2 # => (1/2) ;TI"$r % 2.0 # => 0.5 ;TI" ;TI"*r = Rational(301,100) # => (301/100) ;TI"&r2 = Rational(7,5) # => (7/5) ;TI")r % r2 # => (21/100) ;TI"+r % -r2 # => (-119/100) ;TI"*(-r) % r2 # => (119/100) ;TI")(-r) %-r2 # => (-21/100);T; 0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below000[ I" (p1);T@/FI"Numeric;TcRDoc::NormalClass0[@2FI"%;T