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 / BigDecimal / cdesc-BigDecimal.ri
Size: Mime:
U:RDoc::NormalClass[iI"BigDecimal:ET@I"Numeric;To:RDoc::Markup::Document:@parts[o;;[Ko:RDoc::Markup::Paragraph;[I"OBigDecimal provides arbitrary-precision floating point decimal arithmetic.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading:
leveli:	textI"Introduction;T@o;	;[I"ORuby provides built-in support for arbitrary precision integer arithmetic.;T@o;	;[I"For example:;T@o:RDoc::Markup::Verbatim;[I"*42**13  #=>   1265437718438866624512
;T:@format0o;	;[I"RBigDecimal provides similar support for very large or very accurate floating ;TI"point numbers.;T@o;	;[	I"KDecimal arithmetic is also useful for general calculation, because it ;TI"Pprovides the correct answers people expect--whereas normal binary floating ;TI"Opoint arithmetic often introduces subtle errors because of the conversion ;TI" between base 10 and base 2.;T@o;	;[I"For example, try:;T@o;;[
I"
sum = 0
;TI"10_000.times do
;TI"  sum = sum + 0.0001
;TI"	end
;TI"&print sum #=> 0.9999999999999062
;T;0o;	;[I"'and contrast with the output from:;T@o;;[I"require 'bigdecimal'
;TI"
;TI"sum = BigDecimal.new("0")
;TI"10_000.times do
;TI",  sum = sum + BigDecimal.new("0.0001")
;TI"	end
;TI"print sum #=> 0.1E1
;T;0o;	;[I"Similarly:;T@o;;[I"O(BigDecimal.new("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") #=> true
;TI"
;TI""(1.2 - 1.0) == 0.2 #=> false
;T;0S;;i;
I"4Special features of accurate decimal arithmetic;T@o;	;[I"KBecause BigDecimal is more accurate than normal binary floating point ;TI"1arithmetic, it requires some special values.;T@S;;i;
I"
Infinity;T@o;	;[I"NBigDecimal sometimes needs to return infinity, for example if you divide ;TI"a value by zero.;T@o;;[I"ABigDecimal.new("1.0") / BigDecimal.new("0.0")  #=> Infinity
;TI"CBigDecimal.new("-1.0") / BigDecimal.new("0.0")  #=> -Infinity
;T;0o;	;[I"HYou can represent infinite numbers to BigDecimal using the strings ;TI";<code>'Infinity'</code>, <code>'+Infinity'</code> and ;TI".<code>'-Infinity'</code> (case-sensitive);T@S;;i;
I"Not a Number;T@o;	;[I"OWhen a computation results in an undefined value, the special value +NaN+ ;TI"&(for 'not a number') is returned.;T@o;	;[I"
Example:;T@o;;[I";BigDecimal.new("0.0") / BigDecimal.new("0.0") #=> NaN
;T;0o;	;[I"*You can also create undefined values.;T@o;	;[I"PNaN is never considered to be the same as any other value, even NaN itself:;T@o;;[I"n = BigDecimal.new('NaN')
;TI"n == 0.0 #=> false
;TI"n == n #=> false
;T;0S;;i;
I"Positive and negative zero;T@o;	;[I"QIf a computation results in a value which is too small to be represented as ;TI"Pa BigDecimal within the currently specified limits of precision, zero must ;TI"be returned.;T@o;	;[I"QIf the value which is too small to be represented is negative, a BigDecimal ;TI"(value of negative zero is returned.;T@o;;[I"BBigDecimal.new("1.0") / BigDecimal.new("-Infinity") #=> -0.0
;T;0o;	;[I"DIf the value is positive, a value of positive zero is returned.;T@o;;[I"@BigDecimal.new("1.0") / BigDecimal.new("Infinity") #=> 0.0
;T;0o;	;[I"B(See BigDecimal.mode for how to specify limits of precision.);T@o;	;[I"RNote that +-0.0+ and +0.0+ are considered to be the same for the purposes of ;TI"comparison.;T@o;	;[I"ONote also that in mathematics, there is no particular concept of negative ;TI":or positive zero; true mathematical zero has no sign.;T@S;;i;
I"License;T@o;	;[I"FCopyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.;T@o;	;[I"IYou may distribute under the terms of either the GNU General Public ;TI"FLicense or the Artistic License, as specified in the README file ;TI"$of the BigDecimal distribution.;T@o;	;[I"=Maintained by mrkn <mrkn@mrkn.jp> and ruby-core members.;T@o;	;[I"QDocumented by zzak <zachary@zacharyscott.net>, mathew <meta@pobox.com>, and ;TI"many other contributors.;T:
@fileI" ext/bigdecimal/bigdecimal.c;T:0@omit_headings_from_table_of_contents_below0o;;[o;	;[I"OBigDecimal extends the native Numeric class to provide the #to_digits and ;TI"#to_d methods.;T@o;	;[I"JWhen you require BigDecimal in your application, this method will be ;TI"%available on BigDecimal objects.;T;I"*ext/bigdecimal/lib/bigdecimal/util.rb;T;0o;;[;I"(ext/json/lib/json/add/bigdecimal.rb;T;0;0;0[[U:RDoc::Constant[iI"	BASE;TI"BigDecimal::BASE;T00o;;[o;	;[
I"IBase value used in internal calculations.  On a 32 bit system, BASE ;TI"Jis 10000, indicating that calculation is done in groups of 4 digits. ;TI"J(If it were larger, BASE**2 wouldn't fit in 32 bits, so you couldn't ;TI"Kguarantee that two groups could always be multiplied together without ;TI"overflow.);T;@›;0@›@cRDoc::NormalClass0U;[iI"EXCEPTION_ALL;TI"BigDecimal::EXCEPTION_ALL;T00o;;[o;	;[I"EDetermines whether overflow, underflow or zero divide result in ;FI"4an exception being thrown. See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"EXCEPTION_NaN;TI"BigDecimal::EXCEPTION_NaN;T00o;;[o;	;[I"GDetermines what happens when the result of a computation is not a ;FI"'number (NaN). See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"EXCEPTION_INFINITY;TI"#BigDecimal::EXCEPTION_INFINITY;T00o;;[o;	;[I"ADetermines what happens when the result of a computation is ;FI"$infinity.  See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"EXCEPTION_UNDERFLOW;TI"$BigDecimal::EXCEPTION_UNDERFLOW;T00o;;[o;	;[I"DDetermines what happens when the result of a computation is an ;FI"Kunderflow (a result too small to be represented). See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"EXCEPTION_OVERFLOW;TI"#BigDecimal::EXCEPTION_OVERFLOW;T00o;;[o;	;[I"DDetermines what happens when the result of a computation is an ;FI"Joverflow (a result too large to be represented). See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"EXCEPTION_ZERODIVIDE;TI"%BigDecimal::EXCEPTION_ZERODIVIDE;T00o;;[o;	;[I"CDetermines what happens when a division by zero is performed. ;FI"See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"ROUND_MODE;TI"BigDecimal::ROUND_MODE;T00o;;[o;	;[I"GDetermines what happens when a result must be rounded in order to ;FI">fit in the appropriate number of significant digits. See ;FI"BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"
ROUND_UP;TI"BigDecimal::ROUND_UP;T00o;;[o;	;[I"AIndicates that values should be rounded away from zero. See ;FI"BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"ROUND_DOWN;TI"BigDecimal::ROUND_DOWN;T00o;;[o;	;[I"?Indicates that values should be rounded towards zero. See ;FI"BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"ROUND_HALF_UP;TI"BigDecimal::ROUND_HALF_UP;T00o;;[o;	;[I"KIndicates that digits >= 5 should be rounded up, others rounded down. ;FI"See BigDecimal.mode.;F@;@›;0@›@@¹0U;[iI"ROUND_HALF_DOWN;TI" BigDecimal::ROUND_HALF_DOWN;T00o;;[o;	;[I"KIndicates that digits >= 6 should be rounded up, others rounded down. ;FI"See BigDecimal.mode.;F;@›;0@›@@¹0U;[iI"ROUND_CEILING;TI"BigDecimal::ROUND_CEILING;T00o;;[o;	;[I"2Round towards +Infinity. See BigDecimal.mode.;F@;@›;0@›@@¹0U;[iI"ROUND_FLOOR;TI"BigDecimal::ROUND_FLOOR;T00o;;[o;	;[I"2Round towards -Infinity. See BigDecimal.mode.;F@;@›;0@›@@¹0U;[iI"ROUND_HALF_EVEN;TI" BigDecimal::ROUND_HALF_EVEN;T00o;;[o;	;[I":Round towards the even neighbor. See BigDecimal.mode.;F@;@›;0@›@@¹0U;[iI"
SIGN_NaN;TI"BigDecimal::SIGN_NaN;T00o;;[o;	;[I"AIndicates that a value is not a number. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_POSITIVE_ZERO;TI"#BigDecimal::SIGN_POSITIVE_ZERO;T00o;;[o;	;[I"7Indicates that a value is +0. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_NEGATIVE_ZERO;TI"#BigDecimal::SIGN_NEGATIVE_ZERO;T00o;;[o;	;[I"7Indicates that a value is -0. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_POSITIVE_FINITE;TI"%BigDecimal::SIGN_POSITIVE_FINITE;T00o;;[o;	;[I"HIndicates that a value is positive and finite. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_NEGATIVE_FINITE;TI"%BigDecimal::SIGN_NEGATIVE_FINITE;T00o;;[o;	;[I"HIndicates that a value is negative and finite. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_POSITIVE_INFINITE;TI"'BigDecimal::SIGN_POSITIVE_INFINITE;T00o;;[o;	;[I"JIndicates that a value is positive and infinite. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"SIGN_NEGATIVE_INFINITE;TI"'BigDecimal::SIGN_NEGATIVE_INFINITE;T00o;;[o;	;[I"JIndicates that a value is negative and infinite. See BigDecimal.sign.;F@;@›;0@›@@¹0U;[iI"
INFINITY;TI"BigDecimal::INFINITY;T00o;;[o;	;[I"Positive infinity value.;T@;@›;0@›@@¹0U;[iI"NAN;TI"BigDecimal::NAN;T00o;;[o;	;[I"'Not a Number' value.;T@;@›;0@›@@¹0[[[I"
class;T[[:public[[I"
_load;TI" ext/bigdecimal/bigdecimal.c;T[I"double_fig;T@ž[I"json_create;FI"(ext/json/lib/json/add/bigdecimal.rb;T[I"
limit;T@ž[I"	mode;T@ž[I"new;T@ž[I"save_exception_mode;T@ž[I"save_limit;T@ž[I"save_rounding_mode;T@ž[I"ver;T@ž[:protected[[:private[[I"
instance;T[[;[<[I"%;T@ž[I"*;T@ž[I"**;T@ž[I"+;T@ž[I"+@;T@ž[I"-;T@ž[I"-@;T@ž[I"/;T@ž[I"<;T@ž[I"<=;T@ž[I"<=>;T@ž[I"==;T@ž[I"===;T@ž[I">;T@ž[I">=;T@ž[I"
_dump;T@ž[I"abs;T@ž[I"add;T@ž[I"as_json;F@£[I"	ceil;T@ž[I"coerce;T@ž[I"div;T@ž[I"divmod;T@ž[I"	eql?;T@ž[I"
exponent;T@ž[I"finite?;T@ž[I"fix;T@ž[I"
floor;T@ž[I"	frac;T@ž[I"	hash;T@ž[I"infinite?;T@ž[I"inspect;T@ž[I"modulo;T@ž[I"	mult;T@ž[I"	nan?;T@ž[I"
nonzero?;T@ž[I"
power;T@ž[I"
precs;T@ž[I"quo;T@ž[I"remainder;T@ž[I"
round;T@ž[I"	sign;T@ž[I"
split;T@ž[I"	sqrt;T@ž[I"sub;T@ž[I"	to_d;FI"*ext/bigdecimal/lib/bigdecimal/util.rb;T[I"to_digits;F@[I"	to_f;T@ž[I"	to_i;T@ž[I"to_int;T@ž[I"to_json;F@£[I"	to_r;T@ž[I"	to_s;T@ž[I"
truncate;T@ž[I"
zero?;T@ž[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[@›@¦@©@©cRDoc::TopLevel