⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.25
Server IP:
109.199.105.153
Server:
Linux connect.inboxifs.com 5.15.0-152-generic #162-Ubuntu SMP Wed Jul 23 09:48:42 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
BigDecimal
/
View File Name :
cdesc-BigDecimal.ri
U:RDoc::NormalClass[iI"BigDecimal:ET@I"Numeric;To:RDoc::Markup::Document:@parts[o;;[Po:RDoc::Markup::Paragraph;[I"OBigDecimal provides arbitrary-precision floating point decimal arithmetic.;To:RDoc::Markup::BlankLine S: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("0") ;TI"10_000.times do ;TI"( sum = sum + BigDecimal("0.0001") ;TI" end ;TI"print sum #=> 0.1E1 ;T;0o; ;[I"Similarly:;T@o;;[I"K(BigDecimal("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"9BigDecimal("1.0") / BigDecimal("0.0") #=> Infinity ;TI";BigDecimal("-1.0") / BigDecimal("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"3BigDecimal("0.0") / BigDecimal("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('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":BigDecimal("1.0") / BigDecimal("-Infinity") #=> -0.0 ;T;0o; ;[I"DIf the value is positive, a value of positive zero is returned.;T@o;;[I"8BigDecimal("1.0") / BigDecimal("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"bigdecimal/util;T@o; ;[I"BWhen you require +bigdecimal/util+, the #to_d method will be ;TI"Favailable on BigDecimal and the native Integer, Float, Rational, ;TI"and String classes:;T@o;;[I"require 'bigdecimal/util' ;TI" ;TI"!42.to_d # => 0.42e2 ;TI" 0.5.to_d # => 0.5e0 ;TI""(2/3r).to_d(3) # => 0.667e0 ;TI" "0.5".to_d # => 0.5e0 ;T;0S;;i; I"License;T@o; ;[I"FCopyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.;T@o; ;[I"FBigDecimal is released under the Ruby and 2-clause BSD licenses. ;TI"!See LICENSE.txt for details.;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;;[ ;I"*ext/bigdecimal/lib/bigdecimal/util.rb;T;0o;;[ ;I"(ext/json/lib/json/add/bigdecimal.rb;T;0;0;0[ [U:RDoc::Constant[i I"VERSION;TI"BigDecimal::VERSION;T:public0o;;[o; ;[I"&The version of bigdecimal library;T;@�;0@�@cRDoc::NormalClass0U;[i I" BASE;TI"BigDecimal::BASE;T;0o;;[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@�@@�0U;[i I"EXCEPTION_ALL;TI"BigDecimal::EXCEPTION_ALL;T;0o;;[o; ;[I"EDetermines whether overflow, underflow or zero divide result in ;TI"4an exception being thrown. See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"EXCEPTION_NaN;TI"BigDecimal::EXCEPTION_NaN;T;0o;;[o; ;[I"GDetermines what happens when the result of a computation is not a ;TI"'number (NaN). See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"EXCEPTION_INFINITY;TI"#BigDecimal::EXCEPTION_INFINITY;T;0o;;[o; ;[I"ADetermines what happens when the result of a computation is ;TI"$infinity. See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"EXCEPTION_UNDERFLOW;TI"$BigDecimal::EXCEPTION_UNDERFLOW;T;0o;;[o; ;[I"DDetermines what happens when the result of a computation is an ;TI"Kunderflow (a result too small to be represented). See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"EXCEPTION_OVERFLOW;TI"#BigDecimal::EXCEPTION_OVERFLOW;T;0o;;[o; ;[I"DDetermines what happens when the result of a computation is an ;TI"Joverflow (a result too large to be represented). See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"EXCEPTION_ZERODIVIDE;TI"%BigDecimal::EXCEPTION_ZERODIVIDE;T;0o;;[o; ;[I"CDetermines what happens when a division by zero is performed. ;TI"See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"ROUND_MODE;TI"BigDecimal::ROUND_MODE;T;0o;;[o; ;[I"GDetermines what happens when a result must be rounded in order to ;TI">fit in the appropriate number of significant digits. See ;TI"BigDecimal.mode.;T;@�;0@�@@�0U;[i I" ROUND_UP;TI"BigDecimal::ROUND_UP;T;0o;;[o; ;[I"AIndicates that values should be rounded away from zero. See ;TI"BigDecimal.mode.;T;@�;0@�@@�0U;[i I"ROUND_DOWN;TI"BigDecimal::ROUND_DOWN;T;0o;;[o; ;[I"?Indicates that values should be rounded towards zero. See ;TI"BigDecimal.mode.;T;@�;0@�@@�0U;[i I"ROUND_HALF_UP;TI"BigDecimal::ROUND_HALF_UP;T;0o;;[o; ;[I"KIndicates that digits >= 5 should be rounded up, others rounded down. ;TI"See BigDecimal.mode.;T@;@�;0@�@@�0U;[i I"ROUND_HALF_DOWN;TI" BigDecimal::ROUND_HALF_DOWN;T;0o;;[o; ;[I"KIndicates that digits >= 6 should be rounded up, others rounded down. ;TI"See BigDecimal.mode.;T;@�;0@�@@�0U;[i I"ROUND_CEILING;TI"BigDecimal::ROUND_CEILING;T;0o;;[o; ;[I"2Round towards +Infinity. See BigDecimal.mode.;T@;@�;0@�@@�0U;[i I"ROUND_FLOOR;TI"BigDecimal::ROUND_FLOOR;T;0o;;[o; ;[I"2Round towards -Infinity. See BigDecimal.mode.;T@;@�;0@�@@�0U;[i I"ROUND_HALF_EVEN;TI" BigDecimal::ROUND_HALF_EVEN;T;0o;;[o; ;[I":Round towards the even neighbor. See BigDecimal.mode.;T@;@�;0@�@@�0U;[i I" SIGN_NaN;TI"BigDecimal::SIGN_NaN;T;0o;;[o; ;[I"AIndicates that a value is not a number. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_POSITIVE_ZERO;TI"#BigDecimal::SIGN_POSITIVE_ZERO;T;0o;;[o; ;[I"7Indicates that a value is +0. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_NEGATIVE_ZERO;TI"#BigDecimal::SIGN_NEGATIVE_ZERO;T;0o;;[o; ;[I"7Indicates that a value is -0. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_POSITIVE_FINITE;TI"%BigDecimal::SIGN_POSITIVE_FINITE;T;0o;;[o; ;[I"HIndicates that a value is positive and finite. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_NEGATIVE_FINITE;TI"%BigDecimal::SIGN_NEGATIVE_FINITE;T;0o;;[o; ;[I"HIndicates that a value is negative and finite. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_POSITIVE_INFINITE;TI"'BigDecimal::SIGN_POSITIVE_INFINITE;T;0o;;[o; ;[I"JIndicates that a value is positive and infinite. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I"SIGN_NEGATIVE_INFINITE;TI"'BigDecimal::SIGN_NEGATIVE_INFINITE;T;0o;;[o; ;[I"JIndicates that a value is negative and infinite. See BigDecimal.sign.;T@;@�;0@�@@�0U;[i I" INFINITY;TI"BigDecimal::INFINITY;T;0o;;[o; ;[I"Positive infinity value.;T@;@�;0@�@@�0U;[i I"NAN;TI"BigDecimal::NAN;T;0o;;[o; ;[I"'Not a Number' value.;T@;@�;0@�@@�0[ [[I" class;T[[;[[I" _load;TI" ext/bigdecimal/bigdecimal.c;T[I"double_fig;T@�[I"interpret_loosely;T@�[I"json_create;TI"(ext/json/lib/json/add/bigdecimal.rb;T[I" limit;T@�[I" mode;T@�[I"save_exception_mode;T@�[I"save_limit;T@�[I"save_rounding_mode;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;T@�[I" ceil;T@�[I" clone;T@�[I"coerce;T@�[I"div;T@�[I"divmod;T@�[I"dup;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"n_significant_digits;T@�[I" nan?;T@�[I" nonzero?;T@�[I" power;T@�[I"precision;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;TI"*ext/bigdecimal/lib/bigdecimal/util.rb;T[I"to_digits;T@,[I" to_f;T@�[I" to_i;T@�[I"to_int;T@�[I"to_json;T@�[I" to_r;T@�[I" to_s;T@�[I" truncate;T@�[I" zero?;T@�[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@�@�@�@�cRDoc::TopLevel