mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Added math.rb descriptions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
970ad34c95
commit
c2e6541a6a
2 changed files with 17 additions and 6 deletions
|
@ -91,12 +91,17 @@ 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.
|
This means the number of significant digits in BigDecimal is always a multiple of 4.
|
||||||
<P>
|
<P>
|
||||||
Some more methods are available in Ruby code (not C code).
|
Some more methods are available in Ruby code (not C code).
|
||||||
To use them,just require util.rb as:
|
Functions such as sin,cos ...,are in math.rb in bigdecimal directory.
|
||||||
|
To use them,require math.rb as:
|
||||||
|
<CODE><PRE>
|
||||||
|
require "bigdecimal/math.rb"
|
||||||
|
</PRE></CODE>
|
||||||
|
For details,see the math.rb code and comments.
|
||||||
|
Other utility methods are in util.rb.
|
||||||
|
To use util.rb, require it as:
|
||||||
<CODE><PRE>
|
<CODE><PRE>
|
||||||
require "bigdecimal/util.rb"
|
require "bigdecimal/util.rb"
|
||||||
</PRE></CODE>
|
</PRE></CODE>
|
||||||
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.
|
For details,see the util.rb code.
|
||||||
|
|
||||||
<H4><U>Class methods</U></H4>
|
<H4><U>Class methods</U></H4>
|
||||||
|
|
|
@ -98,9 +98,15 @@ c=a+b
|
||||||
内部の「有効桁数」は4の倍数となっています。
|
内部の「有効桁数」は4の倍数となっています。
|
||||||
<P>
|
<P>
|
||||||
以下のメソッド以外にも、(C ではない) Ruby ソースの形で
|
以下のメソッド以外にも、(C ではない) Ruby ソースの形で
|
||||||
提供されているものもあります。例えば、文字列から BigDecimal への
|
提供されているものもあります。例えば、
|
||||||
変換や、"0.xxxxxEn" という形式ではなく "nnnnn.mmmm" の形式の文字列
|
<CODE><PRE>
|
||||||
へ変換するメソッド等があります。利用するには
|
require "bigdecimal/math.rb"
|
||||||
|
</PRE></CODE>
|
||||||
|
とすることで、sin や cos といった関数が使用できるようになります。
|
||||||
|
使用方法など、詳細は math.rb の内容を参照して下さい。
|
||||||
|
|
||||||
|
その他、Float との相互変換などのメソッドが util.rb でサポートされています。
|
||||||
|
利用するには
|
||||||
<CODE><PRE>
|
<CODE><PRE>
|
||||||
require "bigdecimal/util.rb"
|
require "bigdecimal/util.rb"
|
||||||
</PRE></CODE>
|
</PRE></CODE>
|
||||||
|
|
Loading…
Add table
Reference in a new issue