Wrong descriptions,pointed out by Bret Jolly,in the documents changed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ebe96d582e
commit
611bb8f5a8
@ -379,7 +379,7 @@ after every n digits for readability.
|
|||||||
<CODE><PRE>
|
<CODE><PRE>
|
||||||
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
|
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
|
||||||
</PRE></CODE>
|
</PRE></CODE>
|
||||||
n can be an string representing a positive integer number.
|
n can be a string representing a positive integer number.
|
||||||
<CODE><PRE>
|
<CODE><PRE>
|
||||||
BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
|
BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
|
||||||
</PRE></CODE>
|
</PRE></CODE>
|
||||||
@ -678,10 +678,9 @@ structure.
|
|||||||
</DL>
|
</DL>
|
||||||
|
|
||||||
<H3>Disadvantage of decimal representation</H3>
|
<H3>Disadvantage of decimal representation</H3>
|
||||||
Advantages stated so far can also be disadvantages if the input from outside is
|
Because most computers have no internal decimal representaion.
|
||||||
represented in binary.
|
Once you use BigDecimal,you need to keep using it without
|
||||||
Translation error from decimal to binary or vice versa is inevitable.
|
considering computation cost if exact computation is required.
|
||||||
So,translation from Float(binary) to BigDecimal(decimal) is not alway done exactly.
|
|
||||||
|
|
||||||
<H4>Which is the first input?</H4>
|
<H4>Which is the first input?</H4>
|
||||||
Because most people uses decimal notatin for numeric data representation,
|
Because most people uses decimal notatin for numeric data representation,
|
||||||
|
@ -676,10 +676,11 @@ exponent=1
|
|||||||
|
|
||||||
<H3>10進のデメリット</H3>
|
<H3>10進のデメリット</H3>
|
||||||
実は今までのメリットは、そのままデメリットにもなります。
|
実は今までのメリットは、そのままデメリットにもなります。
|
||||||
そもそも、10進を2進、2進を10進に変換するような操作は変換誤差
|
そもそも、10進を2進に変換するような操作は変換誤差
|
||||||
を伴う場合を回避することはできません。
|
を伴う場合を回避することはできません。
|
||||||
既に計算機内部に取り込まれた2進数値を BigDecimal の内部表現に
|
大概のコンピュータは10進の内部表現を持っていないので、
|
||||||
変換するときには誤差が避けられない場合があります。
|
BigDecimal を利用して誤差無しの計算をする場合は、計算速度
|
||||||
|
を無視しても最後まで BigDecimal を使用続ける必要があります。
|
||||||
|
|
||||||
<H3>最初は何か?</H3>
|
<H3>最初は何か?</H3>
|
||||||
自分で計算するときにわざわざ2進数を使う人は極めてまれです。
|
自分で計算するときにわざわざ2進数を使う人は極めてまれです。
|
||||||
|
Loading…
x
Reference in New Issue
Block a user