Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ruby / usr / share / ri / 2.2.0 / system / Rational / cdesc-Rational.ri
Size: Mime:
U:RDoc::NormalClass[iI"
Rational:ET@I"Numeric;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"NBigDecimal extends the native Rational class to provide the #to_d method.;To:RDoc::Markup::BlankLineo;	;[I"JWhen you require BigDecimal in your application, this method will be ;TI"#available on Rational objects.;T:
@fileI"*ext/bigdecimal/lib/bigdecimal/util.rb;T:0@omit_headings_from_table_of_contents_below0o;;[;I"&ext/json/lib/json/add/rational.rb;T;0o;;[o;	;[I"FA rational number can be represented as a paired integer number; ;TI"Ga/b (b>0).  Where a is numerator and b is denominator.  Integer a ;TI"(equals rational a/1 mathematically.;T@o;	;[I"DIn ruby, you can create rational object with Rational, to_r or ;TI"@rationalize method.  The return values will be irreducible.;T@o:RDoc::Markup::Verbatim;[	I" Rational(1)      #=> (1/1)
;TI" Rational(2, 3)   #=> (2/3)
;TI"!Rational(4, -6)  #=> (-2/3)
;TI" 3.to_r           #=> (3/1)
;T:@format0o;	;[I"HYou can also create rational object from floating-point numbers or ;TI"
strings.;T@o;
;[
I"?Rational(0.3)    #=> (5404319552844595/18014398509481984)
;TI"!Rational('0.3')  #=> (3/10)
;TI" Rational('2/3')  #=> (2/3)
;TI"
;TI"?0.3.to_r         #=> (5404319552844595/18014398509481984)
;TI"!'0.3'.to_r       #=> (3/10)
;TI" '2/3'.to_r       #=> (2/3)
;TI"!0.3.rationalize  #=> (3/10)
;T;0o;	;[I"DA rational object is an exact number, which helps you to write ;TI")program without any rounding errors.;T@o;
;[I"J10.times.inject(0){|t,| t + 0.1}              #=> 0.9999999999999999
;TI"=10.times.inject(0){|t,| t + Rational('0.1')}  #=> (1/1)
;T;0o;	;[I"HHowever, when an expression has inexact factor (numerical value or ;TI"0operation), will produce an inexact result.;T@o;
;[
I"#Rational(10) / 3   #=> (10/3)
;TI"/Rational(10) / 3.0 #=> 3.3333333333333335
;TI"
;TI"$Rational(-8) ** Rational(1, 3)
;TI"D                   #=> (1.0000000000000002+1.7320508075688772i);T;0;I"rational.c;T;0;0;0[[[[[I"
class;T[[:public[[I"json_create;FI"&ext/json/lib/json/add/rational.rb;T[:protected[[:private[[I"
instance;T[[;[[I"*;TI"rational.c;T[I"**;T@c[I"+;T@c[I"-;T@c[I"/;T@c[I"<=>;T@c[I"==;T@c[I"as_json;F@W[I"	ceil;T@c[I"denominator;T@c[I"	fdiv;T@c[I"
floor;T@c[I"inspect;T@c[I"numerator;T@c[I"quo;T@c[I"rationalize;T@c[I"
round;T@c[I"	to_d;FI"*ext/bigdecimal/lib/bigdecimal/util.rb;T[I"	to_f;T@c[I"	to_i;T@c[I"to_json;F@W[I"	to_r;T@c[I"	to_s;T@c[I"
truncate;T@c[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[@@@K@KcRDoc::TopLevel