# [IA-64]BigDecimal#sqrt \$B\$N;EMM(B

e\$B\$3\$s\$K\$A\$Oe(B
e\$B9bLn\$G\$9!#e(B

IA-64e\$B\$N%a%s%F\$r\$7\$F\$\$\$k\$N\$G\$9\$,!"e(BBigDecimal#sqrte\$B\$N%F%9%H\$Ge(BFaile\$B\$7\$F\$*\$j!“e(B
e\$B\$=\$N860x\$,\$h\$/\$o\$+\$j\$^\$;\$s!#e(B
e\$B<1<T\$NJ}\$N\$40U8+\$,\$\$\$?\$@\$1\$l\$P\$H;W\$\$!”%a!<%k\$5\$;\$F\$\$\$?\$@\$-\$^\$9!#e(B

## x = BigDecimal.new((2**100).to_s) assert_equal(1125899906842624, x.sqrt(1)) assert_equal(1125899906842624, x.sqrt(2)) assert_equal(1125899906842624, x.sqrt(3)) # I don’t understand the meaning of argument…

e\$B\$H\$\$\$&ItJ,\$G!"<B9T;~\$N%m%0\$O0J2<\$NDL\$j\$G\$9!#e(B

1. Failure:
test_sqrt_bigdecimal(TestBigDecimal)
[/home/takano/ruby/test/bigdecimal/test_bigdecimal.rb:469]:
Expected 1125899906842624, not
#<BigDecimal:60000000061650b0,‘0.1125899906 8426239999 9999999999
999975E16’,45(54)>.

## 0.1125899906842624E16 0.1125899906842624E16 0.1125899906842624E16

e\$B\$\$\$:\$l\$b0[\$J\$kCM\$,5"\$C\$F\$\$\$k\$N\$G\$9\$,!"e(B
revision 19633
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/log/20080930T132601.txt.gz
e\$B\$G\$OC1=c\$Ke(BFixnume\$B\$H\$NHf3S\$G%Q%9\$7\$F\$\$\$k\$h\$&\$G\$9!#e(B

# IA-64e\$B\$G\$O@:EY\$,\$"\$,\$C\$?\$N\$G!"Hf3S\$9\$k7e?t\$,B?\$/\$J\$C\$F\$\$\$k!)e(B

e\$B<+J,\$O\$“\$^\$j\$3\$3\$i\$X\$s\$N\$3\$H\$K>\$7\$/\$J\$\$\$N\$G!”<1<T\$NJ}\$N\$40U8+\$,;G\$(\$l\$P\$He(B
e\$B;W\$\$!"O"Mm\$5\$;\$F\$\$\$?\$@\$-\$^\$7\$?!#e(B

e\$B\$A\$g\$C\$H\$*\$C\$/\$&\$G!"e(BIA-64e\$B0J30\$Ne(Btrunke\$B\$N4D6-\$r:n\$C\$F\$\$\$J\$\$\$N\$,?=\$7Lu\$J\$\$e(B

e\$B\$H\$3\$m\$J\$N\$G\$9\$,!"?<\$_\$KF~\$k\$h\$&\$G\$7\$?\$i!"4D6-\$r:n\$C\$F\$*\$3\$&\$H;W\$\$\$^\$9!#e(B

e\$B2?\$+\$*J,\$+\$j\$NJ}\$,\$\$\$i\$C\$7\$c\$\$\$^\$7\$?\$i!"\$h\$m\$7\$/\$*4j\$\$\$7\$^\$9!#e(B

e\$B9bLn\$G\$9!#e(B

e\$B\$\$\$:\$l\$b0[\$J\$kCM\$,5"\$C\$F\$\$\$k\$N\$G\$9\$,!"e(B

e\$B\$9\$_\$^\$;\$s!"e(BIA-64e\$B\$He(Bx64e\$B\$OF1\$8CM\$,JV\$C\$F\$\$\$^\$9!#e(B orz

TAKANO Mitsuhiro e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B9bLn\$G\$9!#e(B

e\$B%a!<%j%s%0%j%9%H\$KMpEj\$9\$_\$^\$;\$s!#e(B

require ‘bigdecimal’
p BigDecimal.new( (2100).to_s ).sqrt(1) ==
1125899906842623.99999999999999999975
p BigDecimal.new( (2
100).to_s ).sqrt(2) ==
1125899906842623.99999999999999999975
p BigDecimal.new( (2**100).to_s ).sqrt(3) ==
1125899906842623.99999999999999999975

e\$B\$Ge(B
true
true
true

e\$B\$H\$J\$j\$^\$7\$?!#e(B @ IA-64

e\$B@:EY\$,\$"\$,\$C\$?\$?\$a!"\$b\$H\$Ne(BFixnume\$B\$G\$O0lCW\$7\$J\$+\$C\$?\$h\$&\$G\$9!#e(B
e\$B\$H\$j\$"\$(\$:!"%F%9%H\$Ne(BFixnume\$B\$re(BFloate\$B\$K\$7\$F@:EY\$r\$"\$2\$kI,MW\$,\$"\$k\$h\$&\$G\$9\$,!“e(B
e\$BB>\$N%”!<%-%F%/%A%c\$G\$3\$N%3!<%I\$rF0\$+\$9\$He(Bfalsee\$B\$K\$J\$C\$F\$j\$7\$F\$h\$/\$o\$+\$j\$^e(B
e\$B\$;\$s!#e(B orz

TAKANO Mitsuhiro e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:36630] Re: [IA-64]BigDecimal#sqrt
e\$B\$N;EMMe(B”
on Tue, 30 Sep 2008 15:17:53 +0900, TAKANO Mitsuhiro
[email protected] writes:

|require ‘bigdecimal’
|p BigDecimal.new( (2100).to_s ).sqrt(1) ==
|1125899906842623.99999999999999999975
|p BigDecimal.new( (2
100).to_s ).sqrt(2) ==
|1125899906842623.99999999999999999975
|p BigDecimal.new( (2**100).to_s ).sqrt(3) ==
|1125899906842623.99999999999999999975
|
|e\$B\$Ge(B
|true
|true
|true
|
|e\$B\$H\$J\$j\$^\$7\$?!#e(B @ IA-64

e\$BAG?M\$G?=\$7Lu\$J\$\$\$s\$G\$9\$,!"\$3\$l\$O%F%9%H\$,0-\$\$\$G\$7\$g\$&\$M\$(!#e(B
e\$B=q\$-49\$(\$F\$/\$@\$5\$kJ}\$rJg=8\$7\$^\$9!#e(B

e\$B9bLn\$G\$9!#e(B

# LL Futuree\$B\$N\$H\$-\$O\$"\$j\$,\$H\$&\$4\$6\$\$\$^!A\$9!*!*e(B

|http://www.ruby-lang.org/ja/man/html/BigDecimal.html
|sqrt
e\$B!!e(Bae\$B\$NM-8z7ee(B n e\$B7e\$NJ?J}:,e(B(n
e\$B\$NJ?J}:,\$G\$O\$"\$j\$^\$;\$se(B)e\$B\$r%K%e!<%H%sK!\$G7W;;\$7e(B
e\$B\$^\$9!#e(B
e\$B!!e(Bc = a.sqrt(n)

e\$B\$3\$N%I%-%e%a%s%H\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)
@@ -466,9 +466,9 @@
x = BigDecimal.new(“0.09”)
assert_in_delta(0.3, x.sqrt(1), 0.001)
x = BigDecimal.new((2**100).to_s)

• assert_equal(1125899906842624, x.sqrt(1))
• assert_equal(1125899906842624, x.sqrt(2))
• assert_equal(1125899906842624, x.sqrt(3)) # I don’t understand the
meaning of argument…
• assert_equal(1125899906842624, x.sqrt(100))
• assert_equal(1125899906842624, x.sqrt(200))
• assert_equal(1125899906842624, x.sqrt(300)) # I don’t understand the
meaning of argument…
x = BigDecimal.new(“-” + (2100).to_s)
assert_raise(FloatDomainError) { x.sqrt(1) }
x = BigDecimal.new((2
200).to_s)

Yukihiro M. e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

(snip)

e\$B9bLn\$G\$9!#e(B

e\$B<h\$j9~\$_\$"\$j\$,\$H\$&\$4\$6\$\$\$^!A\$9!#e(B

e\$B%3%_%C%H8"\$O\$^\$@\$\$\$?\$@\$\$\$F\$\$\$^\$;\$s\$,!"\$\$\$D\$+\$\$\$?\$@\$1\$k\$/\$i\$\$\$N@*\$\$\$Ge(B

# e\$B9W8%\$G\$-\$l\$P!"\$H;W\$\$\$^\$9!#e(B

Yukihiro M. e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:36634] Re: [IA-64]BigDecimal#sqrt
e\$B\$N;EMMe(B”
on Tue, 30 Sep 2008 16:49:47 +0900, TAKANO Mitsuhiro
[email protected] writes:

||http://www.ruby-lang.org/ja/man/html/BigDecimal.html
||sqrt
|e\$B!!e(Bae\$B\$NM-8z7ee(B n e\$B7e\$NJ?J}:,e(B(n e\$B\$NJ?J}:,\$G\$O\$“\$j\$^\$;\$se(B)e\$B\$r%K%e!<%H%sK!\$G7W;;\$7e(B
|e\$B\$^\$9!#e(B
|e\$B!!e(Bc = a.sq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$C\$1!#e(B
e\$B<h\$j9~\$s\$G\$*\$-\$^\$9!#e(B

e\$B\$?\$+\$N\$G\$9!#e(B

Yukihiro M. e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B%3%_%C%H8"\$O\$^\$@\$5\$7\$"\$2\$F\$\$\$^\$;\$s\$G\$7\$?\$C\$1!#e(B
e\$B<h\$j9~\$s\$G\$*\$-\$^\$9!#e(B

e\$B\$9\$\$^\$;\$s!#e(B
MacBook(x86_64)e\$B4D6-\$GF0\$+\$7\$F\$
\$?\$ie(BFaile\$B\$7\$F\$7\$^\$\$\$^\$7\$?!&!&!&e(Borz
e\$B!J\$?\$^\$?\$^\$&\$^\$/F0\$\$\$F\$7\$^\$&4D6-\$b\$"\$k\$N\$+\$7\$i!#!Ke(B

e\$B@:EY\$N>.\$5\$\$\$H\$3\$m\$N:9\$r<h\$C\$?\$b\$N\$H@:EY\$NBg\$-\$\$\$H\$3\$m\$N:9\$r<h\$C\$FHf3S\$7e(B
e\$B\$?\$[\$&\$,e(B
e\$B3N<B\$H9M\$(!"0J2<\$N\$h\$&\$K=q\$-49\$(\$^\$7\$?!#\$?\$S\$?\$S\$9\$_\$^\$;\$s!#e(B

e\$B\$J\$s\$@\$+IT0B\$J\$N\$G!"<1<T\$NJ}\$G\$I\$J\$?\$+e(BBigDecimale\$B\$K\$*>\$7\$\$\$+\$?\$,\$\$\$i\$Ce(B
e\$B\$7\$c\$C\$?\$ie(B

# Index: test/bigdecimal/test_bigdecimal.rb

— test/bigdecimal/test_bigdecimal.rb (revision 19669)
+++ test/bigdecimal/test_bigdecimal.rb (working copy)
@@ -466,9 +466,7 @@
x = BigDecimal.new(“0.09”)
assert_in_delta(0.3, x.sqrt(1), 0.001)
x = BigDecimal.new((2**100).to_s)

• assert_equal(1125899906842624, x.sqrt(100))
• assert_equal(1125899906842624, x.sqrt(200))
• assert_equal(1125899906842624, x.sqrt(300)) # I don’t understand the
meaning of argument…
• assert_equal(true, x.sqrt(100) - x.sqrt(200) > x.sqrt(300) -
x.sqrt(400))
x = BigDecimal.new("-" + (2100).to_s)
assert_raise(FloatDomainError) { x.sqrt(1) }
x = BigDecimal.new((2
200).to_s)

e\$B\$?\$S\$?\$S\$9\$_\$^\$;\$s!#e(B
e\$B\$?\$+\$N\$G\$9!#e(B

Yukihiro M. e\$B\$5\$s\$O=q\$-\$^\$7\$?e(B:

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:36662] Re: [IA-64]BigDecimal#sqrt e\$B\$N;EMMe(B”
on Sat, 4 Oct 2008 14:41:21 +0900, TAKANO Mitsuhiro [email protected] writes:

|MacBook(x86_64)e\$B4D6-\$GF0\$+\$7\$F\$_\$?\$ie(BFaile\$B\$7\$F\$7\$^\$\$\$^\$7\$?!&!&!&e(Borz
|e\$B!J\$?\$^\$?\$^\$&\$^\$/F0\$\$\$F\$7\$^\$&4D6-\$b\$"\$k\$N\$+\$7\$i!#!Ke(B

e\$B\$&!<\$`!#e(B

e\$B\$J\$<\$+\$^\$?e(BFaile\$B\$7\$F\$^\$7\$?!&!&!&e(B @ i386
orz

|e\$B@:EY\$N>.\$5\$\$\$H\$3\$m\$N:9\$r<h\$C\$?\$b\$N\$H@:EY\$NBg\$-\$\$\$H\$3\$m\$N:9\$r<h\$C\$FHf3S\$7e(B
|e\$B\$?\$[\$&\$,e(B
|e\$B3N<B\$H9M\$(!"0J2<\$N\$h\$&\$K=q\$-49\$(\$^\$7\$?!#\$?\$S\$?\$S\$9\$_\$^\$;\$s!#e(B

e\$B@dBPCM\$r\$H\$l\$P\$\$\$\$\$N\$+\$7\$i!&!&!&\$H9M\$(\$^\$7\$?\$,!"LLE]\$J\$N\$G!"e(B
BigDecimal_sqrt
e\$B\$N%=!<%9DL\$j\$KM-8z?t;z\$rHf3S\$9\$k\$h\$&\$K=\$@5\$7\$^\$7\$?!#e(B

e\$BN;2r\$G\$9!#\$?\$@!“\$\$\$?\$@\$\$\$?%Q%C%Ae(B(e\$BA02s\$b\$G\$9\$,e(B)e\$B\$N9TF,%9%Z!<%9e(B
e\$B\$,A4It>C\$(\$F\$\$\$k>e\$K@^\$jJV\$7\$F\$7\$^\$C\$F\$\$\$k\$h\$&\$G\$9!#%Q%C%A\$re(B
e\$BEj9F\$5\$l\$k>l9g\$K\$O!”\$=\$NJU\$KCm0U\$7\$F\$\$\$?\$@\$1\$k\$H\$5\$\$\$o\$\$\$G\$9!#e(B

e\$B\$&\$R\$g!#\$9\$\$^\$;\$s!#e(BTerminal.appe\$B\$+\$ie(Bsvn
diffe\$B\$r%3%T\$C\$?\$i\$=\$&\$J\$C\$A\$c\$\$\$^e(B
e\$B\$7\$?!&!&!&e(B
e\$B:#EY\$Oe(BMacVime\$B\$G3+\$-D>\$7\$F\$+\$i%3%T!<\$7\$F\$
\$^\$7\$?!#e(B

irbe\$B\$Ge(Bx64e\$B\$He(Bi386e\$B\$N3NG’\$r\$7!“3N<B\$KBg\$-\$JI}\$,\$”\$k\$3\$H\$r3NG’\$7\$^\$7\$?\$N\$Ge(B

# e\$BBg>fIW\$J\$O\$:\$G\$9!#\$[\$s\$H\$K\$?\$S\$?\$S\$9\$_\$^\$;\$s!#e(B

x = BigDecimal.new((2**100).to_s)
=> #<BigDecimal:363c60,‘0.1267650600 2282294014 9670320537 6E31’,32(36)>
x.sqrt(300).precs
=> [16, 324]
x.sqrt(1200).precs
=> [16, 1224]

# Index: test/bigdecimal/test_bigdecimal.rb

— test/bigdecimal/test_bigdecimal.rb (revision 19688)
+++ test/bigdecimal/test_bigdecimal.rb (working copy)
@@ -466,9 +466,7 @@
x = BigDecimal.new(“0.09”)
assert_in_delta(0.3, x.sqrt(1), 0.001)
x = BigDecimal.new((2**100).to_s)

• assert_equal(1125899906842624, x.sqrt(100))
• assert_equal(1125899906842624, x.sqrt(200))
• assert_equal(1125899906842624, x.sqrt(300)) # I don’t understand the
meaning of argument…
• assert_equal(true, x.sqrt(300).precs.last < x.sqrt(1200).precs.last)
x = BigDecimal.new(“-” + (2100).to_s)
assert_raise(FloatDomainError) { x.sqrt(1) }
x = BigDecimal.new((2
200).to_s)

e\$BK-J!\$G\$9!#e(B

In [ruby-dev:36662]

• assert_equal(1125899906842624, x.sqrt(100))
• assert_equal(1125899906842624, x.sqrt(200))
• assert_equal(1125899906842624, x.sqrt(300)) # I don’t understand the meaning of argument…
• assert_equal(true, x.sqrt(100) - x.sqrt(200) > x.sqrt(300) - x.sqrt(400))

y = BigDecimal(“1125899906842624”)
prec = y.precs[0]
assert_equal(true, (x.sqrt(100) - y).abs <
BigDecimal(“1E#{prec-100}”))
assert_equal(true, (x.sqrt(200) - y).abs <
BigDecimal(“1E#{prec-200}”))
assert_equal(true, (x.sqrt(300) - y).abs <
BigDecimal(“1E#{prec-300}”))

## e\$B\$O\$I\$&\$G\$7\$g\$&!#e(B

ãŸã‹ã®ã§ã™ã€‚

TAKANO Mitsuhiro ã•ã‚“ã¯æ›¸ãã¾ã—ãŸ:

ã†ã²ã‚‡ã€‚ã™ã¿ã¾ã›ã‚“ã€‚Terminal.appã‹ã‚‰svn diffã‚’ã‚³ãƒ”ã£ãŸã‚‰ãã†ãªã£ã¡ã‚ƒã„ã¾
ã—ãŸãƒ»ãƒ»ãƒ»
ä»Šåº¦ã¯MacVimã§é–‹ãç›´ã—ã¦ã‹ã‚‰ã‚³ãƒ”ãƒ¼ã—ã¦ã¿ã¾ã—ãŸã€‚

ãœã‚“ãœã‚“ã ã‚ã§ã—ãŸãƒ»ãƒ»ãƒ»

ãŠã¨ãªã—ãæ·»ä»˜ã—ã¾ã™ã€‚

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:36662] Re: [IA-64]BigDecimal#sqrt
e\$B\$N;EMMe(B”
on Sat, 4 Oct 2008 14:41:21 +0900, TAKANO Mitsuhiro
[email protected] writes:

|MacBook(x86_64)e\$B4D6-\$GF0\$+\$7\$F\$_\$?\$ie(BFaile\$B\$7\$F\$7\$^\$\$\$^\$7\$?!&!&!&e(Borz
|e\$B!J\$?\$^\$?\$^\$&\$^\$/F0\$\$\$F\$7\$^\$&4D6-\$b\$"\$k\$N\$+\$7\$i!#!Ke(B

e\$B\$&!<\$`!#e(B

|e\$B@:EY\$N>.\$5\$\$\$H\$3\$m\$N:9\$r<h\$C\$?\$b\$N\$H@:EY\$NBg\$-\$\$\$H\$3\$m\$N:9\$r<h\$C\$FHf3S\$7e(B
|e\$B\$?\$[\$&\$,e(B
|e\$B3N<B\$H9M\$(!"0J2<\$N\$h\$&\$K=q\$-49\$(\$^\$7\$?!#\$?\$S\$?\$S\$9\$_\$^\$;\$s!#e(B

e\$BN;2r\$G\$9!#\$?\$@!“\$\$\$?\$@\$\$\$?%Q%C%Ae(B(e\$BA02s\$b\$G\$9\$,e(B)e\$B\$N9TF,%9%Z!<%9e(B
e\$B\$,A4It>C\$(\$F\$\$\$k>e\$K@^\$jJV\$7\$F\$7\$^\$C\$F\$\$\$k\$h\$&\$G\$9!#%Q%C%A\$re(B
e\$BEj9F\$5\$l\$k>l9g\$K\$O!”\$=\$NJU\$KCm0U\$7\$F\$\$\$?\$@\$1\$k\$H\$5\$\$\$o\$\$\$G\$9!#e(B

# e\$B\$C\$F!“%3%_%C%H8”\$r\$5\$7\$"\$2\$l\$P\$\$\$\$\$N\$+!#e(B

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:36696] Re: [IA-64]BigDecimal#sqrt
e\$B\$N;EMMe(B”
on Thu, 9 Oct 2008 22:54:48 +0900, TOYOFUKU Chikanobu
[email protected] writes:

| y = BigDecimal(“1125899906842624”)
| e = y.exponent
| assert_equal(true, (x.sqrt(100) - y).abs < BigDecimal(“1E#{e-100}”))
| assert_equal(true, (x.sqrt(200) - y).abs < BigDecimal(“1E#{e-200}”))
| assert_equal(true, (x.sqrt(300) - y).abs < BigDecimal(“1E#{e-300}”))
|
|e\$B\$G\$"\$k\$Y\$-\$G\$7\$?!#e(B
|e\$B\$3\$N>l9g\$?\$^\$?\$^@0?t\$@\$C\$?\$N\$Ge(B prec e\$B\$,e(B e e\$B\$H0lCW\$7\$F\$^\$7\$?\$,!#e(B

e\$B\$3\$N@~\$G=\$@5\$7\$h\$&\$H;W\$\$\$^\$9\$,!“;d\$,M}2r\$7\$F\$J\$\$\$?\$a\$K4V0c\$\$e(B
e\$B\$,\$”\$k\$H\$\$\$1\$^\$;\$s\$+\$i!"e(Btest_bigdecimal.rbe\$B\$KBP\$9\$k%Q%C%A\$N7Ae(B
e\$B\$G\$\$\$?\$@\$1\$^\$;\$s\$+!)e(B

e\$BK-J!\$G\$9!#e(B

In [ruby-dev:36695]

y = BigDecimal(“1125899906842624”)
prec = y.precs[0]
assert_equal(true, (x.sqrt(100) - y).abs < BigDecimal(“1E#{prec-100}”))
assert_equal(true, (x.sqrt(200) - y).abs < BigDecimal(“1E#{prec-200}”))
assert_equal(true, (x.sqrt(300) - y).abs < BigDecimal(“1E#{prec-300}”))

e\$B\$9\$_\$^\$;\$s!#e(B

y = BigDecimal(“1125899906842624”)
e = y.exponent
assert_equal(true, (x.sqrt(100) - y).abs < BigDecimal(“1E#{e-100}”))
assert_equal(true, (x.sqrt(200) - y).abs < BigDecimal(“1E#{e-200}”))
assert_equal(true, (x.sqrt(300) - y).abs < BigDecimal(“1E#{e-300}”))

## e\$B\$G\$"\$k\$Y\$-\$G\$7\$?!#e(B e\$B\$3\$N>l9g\$?\$^\$?\$^@0?t\$@\$C\$?\$N\$Ge(B prec e\$B\$,e(B e e\$B\$H0lCW\$7\$F\$^\$7\$?\$,!#e(B

é«˜é‡Žã§ã™ã€‚

ã“ã®ç·šã§ä¿®æ­£ã—ã‚ˆã†ã¨æ€ã„ã¾ã™ãŒã€ç§ãŒç†è§£ã—ã¦ãªã„ãŸã‚ã«é–“é•ã„
ãŒã‚ã‚‹ã¨ã„ã‘ã¾ã›ã‚“ã‹ã‚‰ã€test_bigdecimal.rbã«å¯¾ã™ã‚‹ãƒ‘ãƒƒãƒã®å½¢
ã§ã„ãŸã ã‘ã¾ã›ã‚“ã‹
ãƒ‘ãƒƒãƒã§ã™ã€‚
ã‚ˆã‚ã—ããŠé¡˜ã„ã—ã¾ã™ã€‚