summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/bigdecimal_en.html
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bigdecimal/bigdecimal_en.html')
-rw-r--r--ext/bigdecimal/bigdecimal_en.html89
1 files changed, 54 insertions, 35 deletions
diff --git a/ext/bigdecimal/bigdecimal_en.html b/ext/bigdecimal/bigdecimal_en.html
index 04dd83a429..5344720adc 100644
--- a/ext/bigdecimal/bigdecimal_en.html
+++ b/ext/bigdecimal/bigdecimal_en.html
@@ -81,21 +81,29 @@ to create BigDecimal objects,the program would like:<BR>
<CODE><PRE>
require 'bigdecimal'
a=BigDecimal::new("0.123456789123456789")
- b=BigDecimal::new("123456.78912345678",40)
+ b=BigDecimal("123456.78912345678",40)
c=a+b
</PRE></CODE>
<H3>List of methods</H3>
-In the following explanations,n specifies the minimum number of resulting significant digits,
-not exactly but slightly excess memories will be allocated to newly created object.
In 32 bits integer system,every 4 digits(in decimal) are computed simultaneously.
This means the number of significant digits in BigDecimal is always a multiple of 4.
+<P>
+Some more methods are available in Ruby code (not C code).
+To use them,just require util.rb as:
+<PRE><CODE>
+require "bigdecimal/util.rb"
+</CODE></PRE>
+String to BigDecimal conversion, BigDecimal to String conversion
+(in "nnnnnn.mmmm" form not in "0.xxxxxEn" form) etc are defined.
+For details,see the util.rb code.
<H4><U>Class methods</U></H4>
<UL>
<LI><B>new</B></LI><BLOCKQUOTE>
"new" method creates a new BigDecimal object.<BR>
-a=BigDecimal::new(s[,n])<BR>
+a=BigDecimal::new(s[,n]) or<BR>
+a=BigDecimal(s[,n]) or<BR>
where:<BR>
s: Initial value string.<BR>
n: Maximum number of significant digits of a. n must be a Fixnum object.
@@ -187,18 +195,6 @@ Base value used in the BigDecimal calculation.
On 32 bits integer system,the value of BASE is 10000.<BR>
b = BigDecimal::BASE<BR>
</BLOCKQUOTE>
-
-<LI><B>E</B></LI><BLOCKQUOTE>
-e = BigDecimal::E(n)<BR>
-where e(=2.718281828....) is the base value of natural logarithm.<BR>
-n specifies the length of significant digits of e.
-
-</BLOCKQUOTE>
-<LI><B>PI</B></LI><BLOCKQUOTE>
-e = BigDecimal::PI(n)<BR>
-returns at least n digits of the ratio of the circumference of a circle to its diameter
-(pi=3.14159265358979....) using J.Machin's formula.<BR>
-</BLOCKQUOTE>
</UL>
<H4><U>Instance methods</U></H4>
@@ -394,14 +390,15 @@ means a = 0.xxxxxxx*10**n.
</BLOCKQUOTE>
<LI><B>to_f</B></LI><BLOCKQUOTE>
-same as dup method.
-creates a new BigDecimal object having same value.
+Creates a new Float object having (nearly) the same value.
+Use split method if you want to convert by yourself.
</BLOCKQUOTE>
</BLOCKQUOTE>
<LI><B>sign</B></LI><BLOCKQUOTE>
-returns the 'attribute' of a.
n = a.sign <BR>
+returns positive value if a &gt; 0,negative value if a &lt; 0,
+otherwise zero if a == 0.<BR>
where the value of n means that a is:<BR>
n = BigDecimal::SIGN_NaN(0) : a is NaN<BR>
n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a is +0<BR>
@@ -455,28 +452,13 @@ where "0x112344" is the address,
'0.314E1' is the value,4 is the number of the significant digits,
and 12 is the maximum number of the significant digits
the object can hold.
-
</BLOCKQUOTE>
-<LI><B>dup</B></LI><BLOCKQUOTE>
-creates a new BigDecimal object having same value.
-</BLOCKQUOTE>
<LI><B>sqrt</B></LI><BLOCKQUOTE>
c = a.sqrt(n)<BR>
computes square root value of a with significant digit number n at least.<BR>
-
-</BLOCKQUOTE>
-<LI><B>sincos</B></LI><BLOCKQUOTE>
-computes and returns sine and cosine value of a with significant digit number n at least.<BR>
-sin,cos = a.sincos(n)<BR>
-Computation may return bad results unless |a|<2*3.1415.....
</BLOCKQUOTE>
-<LI><B>exp</B></LI><BLOCKQUOTE>
-c = a.exp(n)<BR>
-computes the base of natural logarithm value(e=2.718281828....) powered by a
-with significant digit number n at least.<BR>
-</BLOCKQUOTE>
<LI><B>**</B></LI><BLOCKQUOTE>
c = a ** n<BR>
returns the value of a powered by n.
@@ -507,6 +489,41 @@ same as ==,used in case statement.
<LI>&gt;</LI>
<LI>&gt;=</LI>
</UL>
+
+<H4><U>Class methods(trial version)</U></H4>
+Following class methods are in trial stage, and not usable in default.
+Uncomment /* #define ENABLE_TRIAL_METHOD */ in bigdecimal.c, compile and install
+again if you want to use.
+<UL>
+<LI><B>E</B></LI><BLOCKQUOTE>
+e = BigDecimal::E(n)<BR>
+where e(=2.718281828....) is the base value of natural logarithm.<BR>
+n specifies the length of significant digits of e.
+
+</BLOCKQUOTE>
+<LI><B>PI</B></LI><BLOCKQUOTE>
+e = BigDecimal::PI(n)<BR>
+returns at least n digits of the ratio of the circumference of a circle to its diameter
+(pi=3.14159265358979....) using J.Machin's formula.<BR>
+</BLOCKQUOTE>
+</UL>
+
+<H4><U>Instance methods(trial version)</U></H4>
+Following instance methods are in trial stage, and not usable in default.
+Uncomment /* #define ENABLE_TRIAL_METHOD */ in bigdecimal.c, compile and install
+again if you want to use.
+<UL>
+<LI><B>sincos</B></LI><BLOCKQUOTE>
+computes and returns sine and cosine value of a with significant digit number n at least.<BR>
+sin,cos = a.sincos(n)<BR>
+Computation may return bad results unless |a|<2*3.1415.....
+</BLOCKQUOTE>
+<LI><B>exp</B></LI><BLOCKQUOTE>
+c = a.exp(n)<BR>
+computes the base of natural logarithm value(e=2.718281828....) powered by a
+with significant digit number n at least.<BR>
+</BLOCKQUOTE>
+</UL>
<HR>
<H3>About 'coerce'</H3>
@@ -521,7 +538,9 @@ same as ==,used in case statement.
BigDecimal object and the operation is performed,otherwise an error occures.</DD>
</DL>
-Attention must be paid when a String is to be translated to BigDecimal.
+String is not translated to BigDecimal in default.
+Uncomment /* #define ENABLE_NUMERIC_STRING */ in bigdecimal.c, compile and install
+again if you want to enable string to BigDecimal conversion.
Translation stops without error at the character representing non digit.
For instance,"10XX" is translated to 10,"XXXX" is translated to 0.<BR>
String representing zero or infinity such as "Infinity","+Infinity","-Infinity",and "NaN" can also be translated to BigDecimal unless false is specified by mode method.<BR>