2003-08-19 10:21:13 -04:00
<!-- saved from url=(0022)http://internet.e - mail -->
2003-03-28 00:00:21 -05:00
< HTML >
< HEAD >
< META HTTP-EQUIV = "Content-Type" CONTENT = "text/html; charset=Shift_JIS" >
< style type = "text/css" > < ! - -
2003-06-27 00:38:57 -04:00
body { color: #3f0f0f; background: #fefeff; margin-left: 2em; margin-right: 2em;}
h1 { color: #ffffff; background-color: #3939AD; border-color: #FF00FF; width: 100%;
border-style: solid; border-top-width: 0.1em; border-bottom-width: 0.1em; border-right: none;
border-left: none; padding: 0.1em; font-weight: bold; font-size: 160%; text-align: center;
2003-03-28 00:00:21 -05:00
}
2003-06-27 00:38:57 -04:00
h2 { color: #00007f; background-color: #e7e7ff; border-color: #000094; width: 100%;
border-style: solid; border-left: none; border-right: none; border-top-width: 0.1em; border-bottom-width: 0.1em;
2003-03-28 00:00:21 -05:00
padding: 0.1em;
2003-06-27 00:38:57 -04:00
font-weight: bold; font-size: 110%;
2003-03-28 00:00:21 -05:00
}
2003-06-27 00:38:57 -04:00
h3 { color: #00007f; padding: 0.2em; font-size: 110%;}
h4, h5 { color: #000000; padding: 0.2em; font-size: 100%;}
table { margin-top: 0.2em; margin-bottom: 0.2em; margin-left: 2em; margin-right: 2em;}
caption { color: #7f0000; font-weight: bold;}
th { background: #e7e7ff; padding-left: 0.2em; padding-right: 0.2em;}
td { background: #f3f7ff; padding-left: 0.2em; padding-right: 0.2em;}
code { color: #0000df;}
dt { margin-top: 0.2em;}
li { margin-top: 0.2em;}
2003-03-28 00:00:21 -05:00
pre
2003-06-27 00:38:57 -04:00
{ BACKGROUND-COLOR: #d0d0d0; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
BORDER-RIGHT: medium none; BORDER-TOP: medium none; LINE-HEIGHT: 100%; MARGIN: 12px 12px 12px 12px;
PADDING-BOTTOM: 12px; PADDING-LEFT: 12px; PADDING-RIGHT: 12px; PADDING-TOP: 12px;
WHITE-SPACE: pre; WIDTH: 100%
2003-03-28 00:00:21 -05:00
}
-->< / style >
< TITLE > BigDecimal:An extension library for Ruby< / TITLE >
< / HEAD >
< BODY BGCOLOR = #FFFFE0 >
< H1 > BigDecimal(<28> ϒ <C295> <CF92> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <5F> <EFBFBD> Z<EFBFBD> p<EFBFBD> g<EFBFBD> <67> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> u<EFBFBD> <75> <EFBFBD> <EFBFBD> )< / H1 >
< DIV align = "right" > < A HREF = "./bigdecimal_en.html" > English< / A > < / DIV > < BR >
BigDecimal <20> ̓I<CD83> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> w<EFBFBD> <77> <EFBFBD> ̋<EFBFBD> <CC8B> ͂ȃX<C883> N<EFBFBD> <4E> <EFBFBD> v<EFBFBD> g<EFBFBD> <67> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> <EFBFBD> Ruby <20> ɉ ϒ <C295> <CF92> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _
<EFBFBD> v<EFBFBD> Z<EFBFBD> @<40> \<5C> <> <EFBFBD> lj<EFBFBD> <C789> <EFBFBD> <EFBFBD> 邽<EFBFBD> ߂̊g<CC8A> <67> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> u<EFBFBD> <75> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
Ruby <20> ɂ <C982> <C282> Ă̏ڂ<CC8F> <DA82> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> e<EFBFBD> ͈ȉ<CD88> <C889> <EFBFBD> URL<52> <4C> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <C682> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< UL >
< LI > < A HREF = "http://www.ruby-lang.org/ja/" > http://www.ruby-lang.org/ja/< / A > <EFBFBD> FRuby<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> y<EFBFBD> [<5B> W< / LI >
< LI > < A HREF = "http://kahori.com/ruby/ring/" > http://kahori.com/ruby/ring/< / A > <EFBFBD> FRuby<EFBFBD> Ɋւ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> y<EFBFBD> [<5B> W<EFBFBD> <57> <EFBFBD> H<EFBFBD> <48> <EFBFBD> ܂ <EFBFBD> < / LI >
2011-05-22 05:26:02 -04:00
< / UL >
2003-03-28 00:00:21 -05:00
< hr >
< H2 > <EFBFBD> ڎ<EFBFBD> < / H2 >
< UL >
< LI > < A HREF = "#INTRO" > <EFBFBD> ͂<EFBFBD> <EFBFBD> ߂<EFBFBD> < / LI >
< LI > < A HREF = "#SPEC" > <EFBFBD> g<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> @<40> ƃ<EFBFBD> <C683> \<5C> b<EFBFBD> h<EFBFBD> ̈ꗗ< / A > < / LI >
< LI > < A HREF = "#UNDEF" > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> A<EFBFBD> [<5B> <> <EFBFBD> ̈<EFBFBD> <CC88> <EFBFBD> < / A > < / LI >
< LI > < A HREF = "#STRUCT" > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> < / A > < / LI >
< LI > < A HREF = "#BASE" > 2<EFBFBD> i<EFBFBD> <EFBFBD> 10<EFBFBD> i< / A > < / LI >
< LI > < A HREF = "#PREC" > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / A > < / LI >
< / UL >
< HR >
< A NAME = "#INTRO" >
< H2 > <EFBFBD> ͂<EFBFBD> <EFBFBD> ߂<EFBFBD> < / H2 >
Ruby <20> ɂ<EFBFBD> Bignum <20> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> N<EFBFBD> <4E> <EFBFBD> X<EFBFBD> <58> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <41> <EFBFBD> S<EFBFBD> <53> <EFBFBD> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> C<EFBFBD> ӌ<EFBFBD> <EFBFBD> ̕<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> p<EFBFBD> N<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> ł<EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŁA
<EFBFBD> C<EFBFBD> ӌ<EFBFBD> <EFBFBD> ̕<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> p<EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> u<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BigDecimal <20> <> <EFBFBD> 쐬<EFBFBD> <EC90AC> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B
<EFBFBD> s<EFBFBD> <EFBFBD> ⏕<EFBFBD> <EFBFBD> <EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> ǂ<EFBFBD> <EFBFBD> ǂ<EFBFBD> <EFBFBD> A
< A HREF = "mailto:shigeo@tinyforest.gr.jp" > shigeo@tinyforest.gr.jp< / A >
<EFBFBD> ܂ ł<EFBFBD> <EFBFBD> m<EFBFBD> 点<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B<EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> ͑傢<EFBFBD> ɂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> ԂȂǂ̊W<EFBFBD> Ŗ<EFBFBD> <EFBFBD> <EFBFBD>
<EFBFBD> ͂ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B<EFBFBD> ܂ <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> ʂɂ <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ۏł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂ł͂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
<EFBFBD> \<5C> ߁A<DF81> <41> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> ̃v<EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́A<EFBFBD> <EFBFBD> <EFBFBD> R<EFBFBD> ɔz<EFBFBD> z<EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> ς<EFBFBD> <EFBFBD> č\<5C> <> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <41> <EFBFBD> 쌠<EFBFBD> ͕<EFBFBD> <CD95> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B
<EFBFBD> z<EFBFBD> z<EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> ϓ<EFBFBD> <EFBFBD> ̌<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ruby <20> ̂<EFBFBD> <CC82> <EFBFBD> <EFBFBD> ɏ<EFBFBD> <C98F> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> ڂ<EFBFBD> <DA82> <EFBFBD> <EFBFBD> <EFBFBD> README <20> <> <EFBFBD> ǂ<EFBFBD> <C782> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< hr >
< H2 > <EFBFBD> C<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> g<EFBFBD> [<5B> <> <EFBFBD> ɂ <C982> <C282> <EFBFBD> < / H2 >
BigDecimal <20> <> <EFBFBD> ܂ <EFBFBD> Ruby <20> ̍ŐV<C590> ł<EFBFBD> < A HREF = "http://www.ruby-lang.org/ja/" > Ruby<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> y<EFBFBD> [<5B> W< / A > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [<5B> h<EFBFBD> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
<EFBFBD> _<EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [<5B> h<EFBFBD> <68> <EFBFBD> <EFBFBD> <EFBFBD> ŐV<C590> ł<EFBFBD> <C582> 𓀂<EFBFBD> <F0938082> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> ʏ <EFBFBD> <CA8F> ̃C<CC83> <43> <EFBFBD> X<EFBFBD> g<EFBFBD> [<5B> <> <EFBFBD> 菇<EFBFBD> <E88F87> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <73> <EFBFBD> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
Ruby <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> <43> <EFBFBD> X<EFBFBD> g<EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<CE81> <41> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BigDecimal <20> <> <EFBFBD> <EFBFBD> <EFBFBD> p<EFBFBD> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> 悤<EFBFBD> ɂȂ<C982> <C882> ͂<EFBFBD> <CD82> ł<EFBFBD> <C582> B
2011-05-22 05:26:02 -04:00
<EFBFBD> \<5C> [<5B> X<EFBFBD> t<EFBFBD> @<40> C<EFBFBD> <43> <EFBFBD> <EFBFBD>
bigdecimal.c,bigdecimal.h
2003-03-28 00:00:21 -05:00
<EFBFBD> ̂Q<EFBFBD> ݂̂ł<EFBFBD> <EFBFBD> B< BR >
< hr >
< A NAME = "#SPEC" >
< H2 > <EFBFBD> g<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> @<40> ƃ<EFBFBD> <C683> \<5C> b<EFBFBD> h<EFBFBD> ̈ꗗ< / H2 >
2003-07-22 10:04:23 -04:00
<EFBFBD> uRuby<EFBFBD> ͊<EFBFBD> <EFBFBD> ɏ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> ŁA
< CODE > < PRE >
2003-03-28 00:00:21 -05:00
require 'bigdecimal'
a=BigDecimal::new("0.123456789123456789")
2003-07-18 11:23:23 -04:00
b=BigDecimal("123456.78912345678",40)
2003-03-28 00:00:21 -05:00
c=a+b
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-03-28 00:00:21 -05:00
< br >
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> Ȋ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< H3 > <EFBFBD> <EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> ꗗ< / H3 >
2003-07-18 11:23:23 -04:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̃<EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> <68> <EFBFBD> <EFBFBD> <EFBFBD> p<EFBFBD> \<5C> ł<EFBFBD> <C582> B
<EFBFBD> u<EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Ƃ<EFBFBD> BigDecimal <20> <> <EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> <78> <EFBFBD> ۏ<DB8F> <D882> 錅<EFBFBD> <E98C85> <EFBFBD> ł<EFBFBD> <C582> B
2003-07-24 22:26:56 -04:00
<EFBFBD> ҂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł͂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> ̗]<5D> T<EFBFBD> <54> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Čv<C48C> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> ܂ <EFBFBD> <EFBFBD> A<EFBFBD> Ⴆ<EFBFBD> R<EFBFBD> Q<EFBFBD> r<EFBFBD> b<EFBFBD> g<EFBFBD> ̃V<EFBFBD> X<EFBFBD> e<EFBFBD> <EFBFBD> <EFBFBD> ł͂P<EFBFBD> O<EFBFBD> i<EFBFBD> łS<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ɍv<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> ]<5D> <> <EFBFBD> āA<C481> <41> <EFBFBD> <EFBFBD> <EFBFBD> ł́A
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́u<EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> ͂S<EFBFBD> ̔{<7B> <> <EFBFBD> ƂȂ<C682> <C882> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> B
2003-07-18 11:23:23 -04:00
< P >
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̃<EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> ȊO<C88A> ɂ<EFBFBD> <C982> A(C <20> ł͂Ȃ<CD82> ) Ruby <20> \<5C> [<5B> X<EFBFBD> ̌`<60> <>
2003-10-20 23:52:43 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> Ⴆ<EFBFBD> A
< CODE > < PRE >
require "bigdecimal/math.rb"
< / PRE > < / CODE >
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> 邱<EFBFBD> ƂŁAsin <20> <> cos <20> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D690> <EFBFBD> <EFBFBD> g<EFBFBD> p<EFBFBD> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> 悤<EFBFBD> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B
<EFBFBD> g<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> @<40> ȂǁA<C781> ڍׂ<DA8D> math.rb <20> ̓<EFBFBD> <CC93> e<EFBFBD> <65> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <C682> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
<EFBFBD> <EFBFBD> <EFBFBD> ̑<EFBFBD> <EFBFBD> AFloat <20> Ƃ̑<C682> <CC91> ݕϊ<DD95> <CF8A> Ȃǂ̃<C782> <CC83> \<5C> b<EFBFBD> h<EFBFBD> <68> util.rb <20> ŃT<C583> |<7C> [<5B> g<EFBFBD> <67> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɂ<EFBFBD>
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-18 11:23:23 -04:00
require "bigdecimal/util.rb"
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-07-18 11:23:23 -04:00
<EFBFBD> ̂悤<EFBFBD> ɂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> ڍׂ<EFBFBD> util.rb <20> ̓<EFBFBD> <CC93> e<EFBFBD> <65> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <C682> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< H4 > < U > <EFBFBD> N<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h< / U > < / H4 >
2003-03-28 00:00:21 -05:00
< UL >
2003-06-27 00:38:57 -04:00
< LI > < B > new< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> V<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BigDecimal <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <EFBFBD> <F090B690> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
2003-07-18 11:23:23 -04:00
a=BigDecimal::new(s[,n]) <20> ܂ <EFBFBD> <DC82> <EFBFBD> < BR >
a=BigDecimal(s[,n])< BR >
2003-08-19 10:21:13 -04:00
s <20> ͐<EFBFBD> <CD90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> 鏉<EFBFBD> <E98F89> <EFBFBD> l<EFBFBD> <EFBFBD> <F095B68E> <EFBFBD> <EFBFBD> Ŏw<C58E> 肵<EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> X<EFBFBD> y<EFBFBD> [<5B> X<EFBFBD> ͖<EFBFBD> <CD96> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> ܂ <EFBFBD> <DC82> A<EFBFBD> <41> <EFBFBD> f<EFBFBD> ł<EFBFBD> <C582> Ȃ<EFBFBD> <C882> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> o<EFBFBD> <6F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <5F>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͏ I<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ƃ݂Ȃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2003-03-28 00:00:21 -05:00
n <20> ͕K<CD95> v<EFBFBD> ȗL<C897> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ia <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j<EFBFBD> 𐮐<EFBFBD> <F090AE90> Ŏw<C58E> 肵<EFBFBD> ܂ <EFBFBD> <DC82> B
n <20> <> 0 <20> ܂ <EFBFBD> <DC82> ͏ ȗ<CD8F> <C897> <EFBFBD> <EFBFBD> ꂽ<EFBFBD> Ƃ<EFBFBD> <C682> ́An <20> ̒l<CC92> <6C> s <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ݂Ȃ<DD82> <C882> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
s <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> n=0 <20> ̂Ƃ<CC82> <C682> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
a <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 傢<EFBFBD> l<EFBFBD> <6C> <EFBFBD> ̗p<CC97> <70> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-07-22 10:04:23 -04:00
<EFBFBD> ő<EFBFBD> <EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͈ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ȋ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɈӖ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< CODE > < PRE >
BigDecimal("1") / BigDecimal("3") # => 0.3333333333 33E0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.3333333333 3333333333 33333333E0
< / PRE > < / CODE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> X<EFBFBD> ̉<EFBFBD> <EFBFBD> Z<EFBFBD> ɂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ő<EFBFBD> <EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> ̎<EFBFBD> <CC8E> 舵<EFBFBD> <E888B5> <EFBFBD> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> ̃o<CC83> [<5B> W<EFBFBD> <57> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> ύX<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > mode< / B > < / LI > < BLOCKQUOTE >
2003-08-13 10:33:31 -04:00
f = BigDecimal.mode(s[,v])< BR >
BigDecimal<EFBFBD> ̎<EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> ʂ𐧌䂵<EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȗ<EFBFBD> <EFBFBD> A<EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> nil <20> <> <EFBFBD> w<EFBFBD> 肷<EFBFBD> <E882B7> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̐ݒ<EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> ߂<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̎g<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> @<40> <> <EFBFBD> <EFBFBD> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< P >
< B > [<5B> <> <EFBFBD> O<EFBFBD> <4F> <EFBFBD> <EFBFBD> ]< / B > < P >
<EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> ʂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (NaN)<29> <> <EFBFBD> [<5B> <> <EFBFBD> ɂ<EFBFBD> <C982> 鏜<EFBFBD> Z<EFBFBD> ɂȂ<C982> <C882> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̏<EFBFBD> <CC8F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> `<60> <> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
< BLOCKQUOTE >
f = BigDecimal::mode(BigDecimal::EXCEPTION_NaN,flag)< BR >
f = BigDecimal::mode(BigDecimal::EXCEPTION_INFINITY,flag)< BR >
f = BigDecimal::mode(BigDecimal::EXCEPTION_UNDERFLOW,flag)< BR >
f = BigDecimal::mode(BigDecimal::EXCEPTION_OVERFLOW,flag)< BR >
f = BigDecimal::mode(BigDecimal::EXCEPTION_ZERODIVIDE,flag)< BR >
f = BigDecimal::mode(BigDecimal::EXCEPTION_ALL,flag)< BR >
< / BLOCKQUOTE >
EXCEPTION_NaN <20> ͌<EFBFBD> <CD8C> ʂ<EFBFBD> NaN <20> ɂȂ<C982> <C882> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̎w<CC8E> <77> <EFBFBD> ł<EFBFBD> <C582> B< BR >
EXCEPTION_INFINITY <20> ͌<EFBFBD> <CD8C> ʂ<EFBFBD> <CA82> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (<28> }Infinity)<29> ɂȂ<C982> <C882> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̎w<CC8E> <77> <EFBFBD> ł<EFBFBD> <C582> B< BR >
EXCEPTION_UNDERFLOW <20> ͎w<CD8E> <77> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <41> <EFBFBD> _<EFBFBD> [<5B> t<EFBFBD> <74> <EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̎w<CC8E> <77> <EFBFBD> ł<EFBFBD> <C582> B< BR >
EXCEPTION_OVERFLOW <20> ͎w<CD8E> <77> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> [<5B> o<EFBFBD> [<5B> t<EFBFBD> <74> <EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̎w<CC8E> <77> <EFBFBD> ł<EFBFBD> <C582> B< BR >
EXCEPTION_ZERODIVIDE <20> ̓[<5B> <> <EFBFBD> ɂ<EFBFBD> <C982> 銄<EFBFBD> <E98A84> <EFBFBD> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <73> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̎w<CC8E> <77> <EFBFBD> ł<EFBFBD> <C582> B< BR >
EXCEPTION_ALL <20> ́A<CD81> \<5C> ȑS<C891> Ăɑ <C991> <CE82> Ĉꊇ<C488> <EA8A87> <EFBFBD> Đݒ肷<DD92> <E882B7> <EFBFBD> Ƃ<EFBFBD> <C682> Ɏg<C98E> p<EFBFBD> <70> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR > < BR >
flag <20> <> true <20> ̂Ƃ<CC82> <C682> ́A<CD81> w<EFBFBD> 肵<EFBFBD> <E882B5> <EFBFBD> <EFBFBD> <EFBFBD> ԂɂȂ<C982> <C882> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ɗ<EFBFBD> <C997> O<EFBFBD> s<F094AD8D> <73> <EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B< BR >
flag <20> <> false<73> i<EFBFBD> f<EFBFBD> t<EFBFBD> H<EFBFBD> <48> <EFBFBD> g<EFBFBD> j<EFBFBD> Ȃ<EFBFBD> <C882> A<EFBFBD> <41> <EFBFBD> O<EFBFBD> ͔<EFBFBD> <CD94> s<EFBFBD> <73> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B<EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> ʂ͈ȉ<CD88> <C889> ̂悤<CC82> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B< BR >
< BLOCKQUOTE >
EXCEPTION_NaN <20> ̂Ƃ<CC82> <C682> A<EFBFBD> <41> <EFBFBD> <EFBFBD> (NaN)< BR >
EXCEPTION_INFINITY <20> ̂Ƃ<CC82> <C682> A<EFBFBD> <41> <EFBFBD> <EFBFBD> (+ or -Infinity)< BR >
EXCEPTION_UNDERFLOW <20> ̂Ƃ<CC82> <C682> A<EFBFBD> [<5B> <> < BR >
EXCEPTION_OVERFLOW <20> ̂Ƃ<CC82> <C682> A+Infinity <20> <> -Infinity< BR >
EXCEPTION_ZERODIVIDE <20> ̂Ƃ<CC82> <C682> A+Infinity <20> <> -Infinity< BR >
< / BLOCKQUOTE >
EXCEPTION_INFINITY<EFBFBD> AEXCEPTION_OVERFLOW<EFBFBD> AEXCEPTION_ZERODIVIDE
<EFBFBD> ͍<EFBFBD> <EFBFBD> ̂Ƃ<EFBFBD> <EFBFBD> 듯<EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> B< BR >
2003-08-08 11:31:27 -04:00
<EFBFBD> ߂<EFBFBD> <EFBFBD> l<EFBFBD> ́A<EFBFBD> ݒ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̒l<EFBFBD> ł<EFBFBD> <EFBFBD> B<EFBFBD> u<EFBFBD> l<EFBFBD> v<EFBFBD> ̈Ӗ<EFBFBD> <EFBFBD> ́A<EFBFBD> Ⴆ<EFBFBD> <EFBFBD>
2003-06-27 00:38:57 -04:00
BigDecimal::EXCEPTION_NaN<61> Ɓu<C681> l<EFBFBD> v<EFBFBD> <76> & <20> <> <20> [<5B> <> <EFBFBD> ȊO<C88A> Ȃ<EFBFBD> <C882> <EFBFBD>
2003-08-13 10:33:31 -04:00
EXCEPTION_NaN<EFBFBD> <EFBFBD> <EFBFBD> ݒ肳<EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӗ<EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< P >
< B > [<5B> ۂߏ<DB82> <DF8F> <EFBFBD> <EFBFBD> w<EFBFBD> <77> ]< / B > < P >
<EFBFBD> v<EFBFBD> Z<EFBFBD> r<EFBFBD> <EFBFBD> <EFBFBD> ̊ۂߑ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̎w<EFBFBD> 肪<EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< BLOCKQUOTE >
2003-07-27 22:56:43 -04:00
f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
<EFBFBD> ̌`<60> <> <EFBFBD> Ŏw<C58E> 肵<EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
2003-07-23 00:48:56 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŁAflag <20> ͈ȉ<CD88> (<28> <> <EFBFBD> ʓ<EFBFBD> <CA93> ͑Ή<CD91> <CE89> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> <43> <EFBFBD> X<EFBFBD> ^<5E> <> <EFBFBD> X<EFBFBD> <58> <EFBFBD> \<5C> b<EFBFBD> h)<29> ̈<EFBFBD> <CC88> <EFBFBD> <C282> w<EFBFBD> 肵<EFBFBD> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< TABLE >
2003-07-27 22:56:43 -04:00
< TR > < TD > ROUND_UP< / TD > < TD > <EFBFBD> S<EFBFBD> Đ<EFBFBD> <EFBFBD> グ<EFBFBD> ܂ <EFBFBD> <EFBFBD> B< / TD > < / TR >
< TR > < TD > ROUND_DOWN< / TD > < TD > <EFBFBD> S<EFBFBD> Đ<EFBFBD> <EFBFBD> ̂Ă܂ <EFBFBD> (truncate)<29> B< / TD > < / TR >
< TR > < TD > ROUND_HALF_UP< / TD > < TD > <EFBFBD> l<EFBFBD> ̌ܓ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> (<28> f<EFBFBD> t<EFBFBD> H<EFBFBD> <48> <EFBFBD> g)<29> B< / TD > < / TR >
< TR > < TD > ROUND_HALF_DOWN< / TD > < TD > <EFBFBD> ̘Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< / TD > < / TR >
< TR > < TD > ROUND_HALF_EVEN< / TD > < TD > <EFBFBD> l<EFBFBD> ̘Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> T<EFBFBD> ̎<EFBFBD> <EFBFBD> ͏ <EFBFBD> <EFBFBD> ʂP<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̎<EFBFBD> <EFBFBD> ̂J<EFBFBD> <EFBFBD> <EFBFBD> グ<EFBFBD> ܂ <EFBFBD> (Banker's rounding)<29> B< / TD > < / TR >
< TR > < TD > ROUND_CEILING< / TD > < TD > <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ̑傫<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɌJ<EFBFBD> <EFBFBD> <EFBFBD> グ<EFBFBD> ܂ <EFBFBD> (ceil)<29> B< / TD > < / TR >
< TR > < TD > ROUND_FLOOR< / TD > < TD > <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ̏<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɌJ<EFBFBD> 艺<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> (floor)<29> B< / TD > < / TR >
2003-06-27 00:38:57 -04:00
< / TABLE >
2003-07-27 22:56:43 -04:00
<EFBFBD> ߂<EFBFBD> <EFBFBD> l<EFBFBD> ͎w<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> flag <20> ̒l<CC92> ł<EFBFBD> <C582> B
2003-08-08 11:31:27 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> nil <20> <> <EFBFBD> w<EFBFBD> 肷<EFBFBD> <E882B7> <EFBFBD> ƁA<C681> <41> <EFBFBD> <EFBFBD> <EFBFBD> ̐ݒ<CC90> <DD92> l<EFBFBD> <6C> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
mode <20> <> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> ł͊ۂߑ<DB82> <DF91> <EFBFBD> <EFBFBD> ̈ʒu<CA92> <75> <EFBFBD> <EFBFBD> <EFBFBD> [<5B> U<EFBFBD> <55> <EFBFBD> w<EFBFBD> 肷<EFBFBD> 邱<EFBFBD> Ƃ͂ł<CD82> <C582> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B
2003-08-13 10:33:31 -04:00
<EFBFBD> ۂߑ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƈʒu<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ő<EFBFBD> <EFBFBD> 䂵<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EFBFBD> BigDecimal::limit <20> <> truncate/round/ceil/floor<6F> A
2003-07-27 22:56:43 -04:00
add/sub/mult/div <20> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> C<EFBFBD> <43> <EFBFBD> X<EFBFBD> ^<5E> <> <EFBFBD> X<EFBFBD> <58> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> <68> <EFBFBD> g<EFBFBD> p<EFBFBD> <70> <EFBFBD> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > limit([n])< / B > < / LI > < BLOCKQUOTE >
2003-07-24 22:26:56 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BigDecimal<EFBFBD> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> ̍ő包<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n<EFBFBD> <EFBFBD> <EFBFBD> ɐ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
<EFBFBD> ߂<EFBFBD> <EFBFBD> l<EFBFBD> ͐ݒ肷<EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> ̒l<EFBFBD> ł<EFBFBD> <EFBFBD> B<EFBFBD> ݒ<EFBFBD> <EFBFBD> l<EFBFBD> ̃f<EFBFBD> t<EFBFBD> H<EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> l<EFBFBD> ͂O<EFBFBD> ŁA<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ӗ<EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> B
2003-08-13 10:33:31 -04:00
n <20> <> <EFBFBD> w<EFBFBD> 肵<EFBFBD> Ȃ<EFBFBD> <C882> A<EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> n <20> <> nil <20> ̏ꍇ<CC8F> ́A<CD81> <41> <EFBFBD> <EFBFBD> <EFBFBD> ̍ő包<C591> <E58C85> <EFBFBD> <EFBFBD> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B< BR >
2003-07-24 22:26:56 -04:00
<EFBFBD> v<EFBFBD> Z<EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ԂɁ A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̌<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɑ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> 悤<EFBFBD> ȏꍇ
limit <20> ŗ\<5C> ߌ<EFBFBD> <DF8C> <EFBFBD> <EFBFBD> 𐧌<EFBFBD> <F090A78C> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B<EFBFBD> <42> <EFBFBD> ̏ꍇ BigDecimal.mode <20> Ŏw<C58E> 肳<EFBFBD> ꂽ
<EFBFBD> ۂߏ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2003-08-13 10:33:31 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> C<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> ^<5E> <> <EFBFBD> X<EFBFBD> <58> <EFBFBD> \<5C> b<EFBFBD> h (truncate/round/ceil/floor/add/sub/mult/div) <20> <>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> limit <20> <> <EFBFBD> <EFBFBD> <EFBFBD> D<EFBFBD> 悳<EFBFBD> <E682B3> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
2003-06-27 00:38:57 -04:00
mf = BigDecimal::limit(n)< BR >
< / BLOCKQUOTE >
2003-07-24 22:26:56 -04:00
2003-06-27 00:38:57 -04:00
< LI > < B > double_fig< / B > < / LI > < BLOCKQUOTE >
Ruby <20> <> Float <20> N<EFBFBD> <4E> <EFBFBD> X<EFBFBD> <58> <EFBFBD> ێ<EFBFBD> <DB8E> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
< CODE > < PRE >
p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
< / PRE > < / CODE >
double_fig<EFBFBD> ͈ȉ<EFBFBD> <EFBFBD> <EFBFBD> C <20> v<EFBFBD> <76> <EFBFBD> O<EFBFBD> <4F> <EFBFBD> <EFBFBD> <EFBFBD> ̌<EFBFBD> <CC8C> ʂƓ<CA82> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
< CODE > < PRE >
double v = 1.0;
int double_fig = 0;
while(v + 1.0 > 1.0) {
++double_fig;
v /= 10;
}
< / PRE > < / CODE >
< / BLOCKQUOTE >
< LI > < B > BASE< / B > < / LI > < BLOCKQUOTE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̒l<EFBFBD> ł<EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 32 <20> r<EFBFBD> b<EFBFBD> g<EFBFBD> ̏<EFBFBD> <CC8F> <EFBFBD> <EFBFBD> n<EFBFBD> ł<EFBFBD> 10000<30> ł<EFBFBD> <C582> B< BR >
b = BigDecimal::BASE< BR >
< / BLOCKQUOTE >
< / UL >
< H4 > < U > <EFBFBD> C<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> ^<5E> <> <EFBFBD> X<EFBFBD> <58> <EFBFBD> \<5C> b<EFBFBD> h< / U > < / H4 >
< UL >
< LI > < B > +< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> ic = a + b<> j< BR >
c <20> ̐<EFBFBD> <CC90> x<EFBFBD> ɂ <C982> <C282> Ắu< A HREF = "#PREC" > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / A > <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > -< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> ic = a - b<> j<EFBFBD> A<EFBFBD> ܂ <EFBFBD> <DC82> ͕<EFBFBD> <CD95> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ]<5D> ic = -a<> j< BR >
c <20> ̐<EFBFBD> <CC90> x<EFBFBD> ɂ <C982> <C282> Ắu< A HREF = "#PREC" > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / A > <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > *< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> Z(c = a * b)< BR >
c<EFBFBD> ̐<EFBFBD> <EFBFBD> x<EFBFBD> <EFBFBD> (a<> ̐<EFBFBD> <CC90> x)+(b<> ̐<EFBFBD> <CC90> x)<29> <> <EFBFBD> x<EFBFBD> ł<EFBFBD> <C582> B< br >
<EFBFBD> ڂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́u< A HREF = "#PREC" > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / A > <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > /< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> Z(c = a / b)< BR >
c <20> ̐<EFBFBD> <CC90> x<EFBFBD> ɂ <C982> <C282> Ắu< A HREF = "#PREC" > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / A > <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-08-01 00:48:32 -04:00
< LI > < B > add(b,n)< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
c = a.add(b,n)< BR >
2003-08-29 09:37:44 -04:00
c = a + b <20> <> <EFBFBD> ő<EFBFBD> <C591> <EFBFBD> n <20> <> <EFBFBD> ܂ Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
a + b <20> ̐<EFBFBD> <CC90> x<EFBFBD> <78> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> BigDecimal.mode <20> Ŏw<C58E> 肳<EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> @<40> Ŋۂ߂<DB82> <DF82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
n <20> <> <EFBFBD> [<5B> <> <EFBFBD> Ȃ<EFBFBD> + <20> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-08-01 00:48:32 -04:00
< LI > < B > sub(b,n)< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
c = a.sub(b,n)< BR >
2003-08-29 09:37:44 -04:00
c = a - b <20> <> <EFBFBD> ő<EFBFBD> <C591> <EFBFBD> n <20> <> <EFBFBD> ܂ Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
a - b <20> ̐<EFBFBD> <CC90> x<EFBFBD> <78> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> BigDecimal.mode <20> Ŏw<C58E> 肳<EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> @<40> Ŋۂ߂<DB82> <DF82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
n <20> <> <EFBFBD> [<5B> <> <EFBFBD> Ȃ<EFBFBD> - <20> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-08-01 00:48:32 -04:00
< LI > < B > mult(b,n)< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
c = a.mult(b,n)< BR >
2003-08-29 09:37:44 -04:00
c = a * b <20> <> <EFBFBD> ő<EFBFBD> <C591> <EFBFBD> n <20> <> <EFBFBD> ܂ Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
a * b <20> ̐<EFBFBD> <CC90> x<EFBFBD> <78> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> BigDecimal.mode <20> Ŏw<C58E> 肳<EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> @<40> Ŋۂ߂<DB82> <DF82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
n <20> <> <EFBFBD> [<5B> <> <EFBFBD> Ȃ<EFBFBD> * <20> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-08-01 00:48:32 -04:00
< LI > < B > div(b[,n])< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
2003-07-24 22:26:56 -04:00
c = a.div(b,n)< BR >
c = a / b <20> <> <EFBFBD> ő<EFBFBD> <C591> <EFBFBD> n <20> <> <EFBFBD> ܂ Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-08-01 00:48:32 -04:00
a / b <20> ̐<EFBFBD> <CC90> x<EFBFBD> <78> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> BigDecimal.mode <20> Ŏw<C58E> 肳<EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> @<40> Ŋۂ߂<DB82> <DF82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
2003-08-29 09:37:44 -04:00
n <20> <> <EFBFBD> [<5B> <> <EFBFBD> Ȃ<EFBFBD> / <20> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B< BR >
2003-08-01 00:48:32 -04:00
n <20> <> <EFBFBD> ȗ<EFBFBD> <C897> <EFBFBD> <EFBFBD> ꂽ<EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> Float#div <20> Ɠ<EFBFBD> <C693> l<EFBFBD> Ɍ<EFBFBD> <C98C> ʂ<EFBFBD> <CA82> <EFBFBD> <EFBFBD> <EFBFBD> (BigDecimal)<29> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-07-24 22:26:56 -04:00
2003-06-27 00:38:57 -04:00
< LI > < B > fix< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a <20> ̏<EFBFBD> <CC8F> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <C889> ̐<CC90> <D882> ̂āB< BR >
c = a.fix
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > frac< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a <20> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̐<CC90> <D882> ̂āB< BR >
c = a.frac
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > floor[(n)]< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
c = a.floor< BR >
2003-06-27 00:38:57 -04:00
a <20> ȉ<EFBFBD> <C889> ̍ő吮<C591> <E590AE> <EFBFBD> iBigDecimal <20> l<EFBFBD> j<EFBFBD> <6A> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-06-27 00:38:57 -04:00
c = BigDecimal("1.23456").floor # ==> 1
c = BigDecimal("-1.23456").floor # ==> -2
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɉ<EFBFBD> <EFBFBD> <EFBFBD> n <20> <> <EFBFBD> ^<5E> <> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B< BR >
n>=0 <20> Ȃ<EFBFBD> <C882> A<EFBFBD> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> 𑀍삵<F091808D> ܂ <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <C889> <EFBFBD> <EFBFBD> A<EFBFBD> ő<EFBFBD> n <20> <> <EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> )<29> B< BR >
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ƃ<CC82> <C682> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> _<EFBFBD> ȏ<EFBFBD> n <20> <> <EFBFBD> ڂ𑀍삵<F091808D> ܂ <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ʒu<CA92> <75> <EFBFBD> 獶<EFBFBD> ɏ<EFBFBD> <C98F> Ȃ<EFBFBD> <C882> Ƃ<EFBFBD> n <20> <EFBFBD> 0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> т܂ <D182> )<29> B< BR >
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-27 22:56:43 -04:00
c = BigDecimal("1.23456").floor(4) # ==> 1.2345
c = BigDecimal("15.23456").floor(-1) # ==> 10.0
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > ceil[(n)]< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
c = a.ceil< BR >
2003-06-27 00:38:57 -04:00
a <20> ȏ<EFBFBD> <C88F> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> ̂<EFBFBD> <CC82> <EFBFBD> <EFBFBD> A<EFBFBD> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> A<EFBFBD> <41> <EFBFBD> ̒l<CC92> iBigDecimal <20> l<EFBFBD> j<EFBFBD> <6A> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-06-27 00:38:57 -04:00
c = BigDecimal("1.23456").ceil # ==> 2
c = BigDecimal("-1.23456").ceil # ==> -1
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɉ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ^<5E> <> <EFBFBD> āA<C481> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> 𑀍삷<F091808D> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B< BR >
n>=0 <20> Ȃ<EFBFBD> <C882> A<EFBFBD> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> 𑀍삵<F091808D> ܂ <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <C889> <EFBFBD> <EFBFBD> A<EFBFBD> ő<EFBFBD> n <20> <> <EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> )<29> B< BR >
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ƃ<CC82> <C682> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> _<EFBFBD> ȏ<EFBFBD> n <20> <> <EFBFBD> ڂ<EFBFBD> <DA82> 𑀍삵<F091808D> ܂ <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ʒu<CA92> <75> <EFBFBD> 獶<EFBFBD> ɏ<EFBFBD> <C98F> Ȃ<EFBFBD> <C882> Ƃ<EFBFBD> n <20> <EFBFBD> 0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> т܂ <D182> )<29> B< BR >
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-27 22:56:43 -04:00
c = BigDecimal("1.23456").ceil(4) # ==> 1.2346
c = BigDecimal("15.23456").ceil(-1) # ==> 20.0
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > round[(n[,b])]< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
c = a.round< BR >
2003-07-27 22:56:43 -04:00
2011-05-22 05:26:02 -04:00
<EFBFBD> N<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h BigDecimal::mode(BigDecimal::ROUND_MODE,flag) <20> Ŏw<C58E> 肵<EFBFBD> <E882B5>
2003-07-27 22:56:43 -04:00
ROUND_MODE <20> ɏ]<5D> <> <EFBFBD> Ċۂߑ<DB82> <DF91> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <73> <EFBFBD> ܂ <EFBFBD> <DC82> B
BigDecimal::mode(BigDecimal::ROUND_MODE,flag) <20> ʼn<EFBFBD> <C589> <EFBFBD> <EFBFBD> w<EFBFBD> 肹<EFBFBD> <E882B9> <EFBFBD> A<EFBFBD> <41> <EFBFBD> A<C281> <41> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> 肵<EFBFBD> Ȃ<EFBFBD> <EFBFBD> ꍇ<EFBFBD> ́u<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʂ̐<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ̌ܓ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Đ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> iBigDecimal <20> l<EFBFBD> j<EFBFBD> v<EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> <DC82> B< BR >
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-06-27 00:38:57 -04:00
c = BigDecimal("1.23456").round # ==> 1
c = BigDecimal("-1.23456").round # ==> -1
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɉ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ^<5E> <> <EFBFBD> āA<C481> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> 𑀍삷<F091808D> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B< BR >
2003-07-27 22:56:43 -04:00
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̎<EFBFBD> <CC8E> ́A<CD81> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ۂ߂܂ <DF82> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <C889> <EFBFBD> <EFBFBD> A<EFBFBD> ő<EFBFBD> n <20> <> <EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> )<29> B< BR >
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ƃ<CC82> <C682> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> _<EFBFBD> ȏ<EFBFBD> n <20> <> <EFBFBD> ڂ<EFBFBD> <DA82> ۂ߂܂ <DF82> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ʒu<CA92> <75> <EFBFBD> 獶<EFBFBD> ɏ<EFBFBD> <C98F> Ȃ<EFBFBD> <C882> Ƃ<EFBFBD> n <20> <EFBFBD> 0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> т܂ <D182> )<29> B
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-27 22:56:43 -04:00
c = BigDecimal("1.23456").round(4) # ==> 1.2346
c = BigDecimal("15.23456").round(-1) # ==> 20.0
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-07-27 22:56:43 -04:00
<EFBFBD> Q<EFBFBD> Ԗڂ̈<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> 肷<EFBFBD> <EFBFBD> <EFBFBD> ƁABigDecimal#mode <20> ̎w<CC8E> <77> <EFBFBD> <EFBFBD> <F096B38E> <EFBFBD> <EFBFBD> āA<C481> w<EFBFBD> 肳<EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> @<40> <>
<EFBFBD> ۂߑ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-27 22:56:43 -04:00
c = BigDecimal("1.23456").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
c = BigDecimal("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > truncate< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
c = a.truncate< BR >
2003-06-27 00:38:57 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̐<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂ĂĐ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> iBigDecimal <20> l<EFBFBD> j<EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> <DC82> B< BR >
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɉ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ^<5E> <> <EFBFBD> āA<C481> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> 𑀍삷<F091808D> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B< BR >
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̎<EFBFBD> <CC8E> ́A<CD81> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> n+1 <20> ʂ̐<CA82> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D882> ̂Ă܂ <C482> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <C889> <EFBFBD> <EFBFBD> A<EFBFBD> ő<EFBFBD> n <20> <> <EFBFBD> ɂ<EFBFBD> <C982> ܂ <EFBFBD> )<29> B
n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ƃ<CC82> <C682> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> _<EFBFBD> ȏ<EFBFBD> n <20> <> <EFBFBD> ڂ<EFBFBD> <DA82> 𑀍삵<F091808D> ܂ <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ʒu<CA92> <75> <EFBFBD> 獶<EFBFBD> ɏ<EFBFBD> <C98F> Ȃ<EFBFBD> <C882> Ƃ<EFBFBD> n <20> <EFBFBD> 0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> т܂ <D182> )<29> B< BR >
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-07-27 22:56:43 -04:00
c = BigDecimal("1.23456").truncate(4) # ==> 1.2345
c = BigDecimal("15.23456").truncate(-1) # ==> 10.0
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > abs< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> ̐<EFBFBD> <EFBFBD> Β l< BR >
c = a.abs< BR >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > to_i< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ȉ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂ĂĐ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɕϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
i = a.to_i< BR >
i <20> ͒l<CD92> ɉ<EFBFBD> <C989> <EFBFBD> <EFBFBD> <EFBFBD> Fixnum <20> <> Bignum <20> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B
a <20> <> Infinity <20> <> NaN <20> ̂Ƃ<CC82> <C682> Ai <20> <> nil <20> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > to_f< / B > < / LI > < BLOCKQUOTE >
2003-07-18 11:23:23 -04:00
Float <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> ɕϊ<C995> <CF8A> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> 肫<EFBFBD> ߍׂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> K<EFBFBD> v<EFBFBD> Ȃ<EFBFBD> <EFBFBD> <EFBFBD> split <20> <> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> 𗘗p<F0979897> <70> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > to_s[(n)]< / B > < / LI > < BLOCKQUOTE >
2003-08-08 11:31:27 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɕϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> (<28> f<EFBFBD> t<EFBFBD> H<EFBFBD> <48> <EFBFBD> g<EFBFBD> <67> "0.xxxxxEn" <20> ̌`<60> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> j<EFBFBD> B
< CODE > < PRE >
BigDecimal("1.23456").to_s # ==> "0.123456E1"
< / PRE > < / CODE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> ɐ<EFBFBD> <C990> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> 肳<EFBFBD> ꂽ<EFBFBD> Ƃ<EFBFBD> <C682> ́A<CD81> <41> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ŕ<EFBFBD> <C595> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 鍶<EFBFBD> E<EFBFBD> <45> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <41> <EFBFBD> ꂼ<EFBFBD> <EA82BC> n <20> <> <EFBFBD> <EFBFBD>
<EFBFBD> ɋŋ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< CODE > < PRE >
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
< / PRE > < / CODE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> ɐ<EFBFBD> <C990> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> 肷<EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
< CODE > < PRE >
BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
< / PRE > < / CODE >
2003-08-19 10:21:13 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̍ŏ<EFBFBD> <EFBFBD> <EFBFBD> '+'<27> i<EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> ' '<27> j<EFBFBD> <6A> <EFBFBD> t<EFBFBD> <74> <EFBFBD> <EFBFBD> <EFBFBD> ƁA<C681> l<EFBFBD> <6C> <EFBFBD> <EFBFBD> <EFBFBD> ̏ꍇ<CC8F> A<EFBFBD> 擪<EFBFBD> <E693AA> '+'<27> i<EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> ' '<27> j<EFBFBD> <6A> <EFBFBD> t<EFBFBD> <74> <EFBFBD> ܂ <EFBFBD>
<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> ̏ꍇ<EFBFBD> ́A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '-' <20> <> <EFBFBD> t<EFBFBD> <74> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> j<EFBFBD> B
< CODE > < PRE >
BigDecimal("0.1234567890123456789").to_s(" 10") # ==> " 0.1234567890 123456789E0"
BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E0"
BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
< / PRE > < / CODE >
2003-08-08 11:31:27 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɕ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̍Ō<EFBFBD> <EFBFBD> <EFBFBD> E(<28> ܂ <EFBFBD> <DC82> <EFBFBD> e) <20> <> F(<28> ܂ <EFBFBD> <DC82> <EFBFBD> f) <20> <> <EFBFBD> w<EFBFBD> 肷<EFBFBD> 邱<EFBFBD> ƂŁA<C581> ȉ<EFBFBD> <C889> ̂悤<CC82> <E682A4>
<EFBFBD> \<5C> <> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> ύX<CF8D> <58> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
< CODE > < PRE >
BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
BigDecimal("1234567890.123456789").to_s("F") # ==> "1234567890.123456789"
BigDecimal("1234567890.123456789").to_s("5E") # ==> "0.12345 67890 12345 6789E10"
BigDecimal("1234567890.123456789").to_s("5F") # ==> "12345 67890.12345 6789"
< / PRE > < / CODE >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > exponent< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> w<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 𐮐<EFBFBD> <EFBFBD> l<EFBFBD> ŕԂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
n = a.exponent < BR >
<EFBFBD> <EFBFBD> a <20> ̒l<CC92> <6C> 0.xxxxxxx*10**n <20> <> <EFBFBD> Ӗ<EFBFBD> <D396> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-07-22 10:04:23 -04:00
< / BLOCKQUOTE >
2003-08-08 11:31:27 -04:00
< LI > < B > precs< / B > < / LI > < BLOCKQUOTE >
n,m = a.precs< BR >
2003-07-22 10:04:23 -04:00
a <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (n) <20> ƍ ő<C68D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (m) <20> ̔z<CC94> <7A> <EFBFBD> <EFBFBD> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< LI > < B > sign< / B > < / LI > < BLOCKQUOTE >
2003-07-18 11:23:23 -04:00
<EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (sign > 0)<29> A<EFBFBD> <41> (sign < 0)<29> A<EFBFBD> <41> <EFBFBD> ̑<EFBFBD> (sigh==0)<29> ł<EFBFBD> <C582> 邩<EFBFBD> ̏<EFBFBD> <CC8F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-03-28 00:00:21 -05:00
n = a.sign < BR >
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> n <20> ̒l<CC92> <6C> a <20> <> <EFBFBD> ȉ<EFBFBD> <C889> ̂Ƃ<CC82> <C682> <EFBFBD> <EFBFBD> Ӗ<EFBFBD> <D396> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
() <20> ̒<EFBFBD> <CC92> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> ́A<CD81> <41> <EFBFBD> ۂ̒l<CC92> ł<EFBFBD> (< A HREF = "#STRUCT" > <EFBFBD> u<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> v< / A > <EFBFBD> <EFBFBD> <EFBFBD> Q<EFBFBD> <EFBFBD> )<29> B< BR >
n = BigDecimal::SIGN_NaN(0) : a <20> <> NaN< BR >
n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a <20> <> +0< BR >
n = BigDecimal::SIGN_NEGATIVE_ZERO(-1) : a <20> <> -0< BR >
n = BigDecimal::SIGN_POSITIVE_FINITE(2) : a <20> ͐<EFBFBD> <CD90> ̒l< BR >
n = BigDecimal::SIGN_NEGATIVE_FINITE(-2) : a <20> ͕<EFBFBD> <CD95> ̒l< BR >
n = BigDecimal::SIGN_POSITIVE_INFINITE(3) : a <20> <> +Infinity< BR >
n = BigDecimal::SIGN_NEGATIVE_INFINITE(-3) : a <20> <> -Infinity< BR >
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > nan?< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a.nan? <20> <> a <20> <> NaN<61> ̂Ƃ<CC82> <C682> ^<5E> <> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > infinite?< / B > < / LI > < BLOCKQUOTE >
a.infinite? <20> <> a <20> <> +<2B> <> <EFBFBD> ̂Ƃ<CC82> 1 <20> A-<2D> <> <EFBFBD> ̂Ƃ<CC82> <C682> <EFBFBD> -1<> A<EFBFBD> <41> <EFBFBD> <EFBFBD> <EFBFBD> ȊO<C88A> ̂Ƃ<CC82> <C682> <EFBFBD> nil <20> <> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
< / BLOCKQUOTE >
< LI > < B > finite?< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a.finite? <20> <> a <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> NaN <20> łȂ<C582> <C882> Ƃ<EFBFBD> <C682> ^<5E> <> <EFBFBD> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > zero?< / B > < / LI > < BLOCKQUOTE >
a <20> <> 0 <20> Ȃ<EFBFBD> true <20> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B< BR >
c = a.zero?
< / BLOCKQUOTE >
< LI > < B > nonzero?< / B > < / LI > < BLOCKQUOTE >
a <20> <> 0 <20> Ȃ<EFBFBD> nil<69> A0 <20> ȊO<C88A> Ȃ<EFBFBD> a <20> <> <EFBFBD> ̂<EFBFBD> <CC82> ̂<EFBFBD> <CC82> Ԃ<EFBFBD> <D482> ܂ <EFBFBD> <DC82> B< BR >
c = a.nonzero?
2003-03-28 00:00:21 -05:00
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > split< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
BigDecimal <20> l<EFBFBD> <6C> 0.xxxxxxx*10**n <20> ƕ\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> Ɂ A<C981> <41> <EFBFBD> <EFBFBD> <EFBFBD> iNaN<61> ̂Ƃ<CC82> <C682> <EFBFBD>
0<EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȊO<EFBFBD> <EFBFBD> +1<> <31> -1<> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> j<EFBFBD> A
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̕<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i"xxxxxxx"<22> j<EFBFBD> ƁA<C681> <EFBFBD> i10<31> j<EFBFBD> A<EFBFBD> X<EFBFBD> Ɏw<C98E> <77> n <20> <> <EFBFBD> z<EFBFBD> <7A> <EFBFBD> <EFBFBD>
<EFBFBD> Ԃ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
2003-06-27 00:38:57 -04:00
a=BigDecimal::new("3.14159265")< BR >
f,x,y,z = a.split< BR >
2003-03-28 00:00:21 -05:00
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƁAf=+1<> Ax="314159265"<22> Ay=10<31> Az=1<> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B< BR >
<EFBFBD> ]<5D> <> <EFBFBD> āA< BR >
s = "0."+x< BR >
b = f*(s.to_f)*(y**z)< BR >
<EFBFBD> <EFBFBD> Float <20> ɕϊ<C995> <CF8A> <EFBFBD> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > inspect< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
<EFBFBD> f<EFBFBD> o<EFBFBD> b<EFBFBD> O<EFBFBD> o<EFBFBD> ͂Ɏg<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
p a=BigDecimal::new("3.14",10)< BR >
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƁA[0x112344:'0.314E1',4(12)]<5D> ̂悤<CC82> ɏo<C98F> ͂<EFBFBD> <CD82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> ŏ<EFBFBD> <EFBFBD> <EFBFBD> 16<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> ̓I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> ̃A<EFBFBD> h<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> '0.314E1' <20> ͒l<CD92> A
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 4<EFBFBD> ͌<EFBFBD> <EFBFBD> ݂̗L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (<28> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> )<29> A
<EFBFBD> Ō<EFBFBD> <EFBFBD> ̓I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 蓾<EFBFBD> <EFBFBD> <EFBFBD> ő包<EFBFBD> <EFBFBD> <EFBFBD> ɂȂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
< LI > < B > **< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a <20> <> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> <42> <EFBFBD> ͐<EFBFBD> <CD90> <EFBFBD> <EFBFBD> B< BR >
2003-06-27 00:38:57 -04:00
c = a ** n< BR >
<EFBFBD> <EFBFBD> <EFBFBD> ʂƂ<EFBFBD> <EFBFBD> <EFBFBD> c <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> a <20> <> n <20> {<7B> ȏ<EFBFBD> <C88F> ɂȂ<C982> <C882> ̂Œ<CC82> <C592> ӁB
< / BLOCKQUOTE >
< LI > < B > power< / B > < / LI > < BLOCKQUOTE >
** <20> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ŁAa <20> <> n <20> <> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> <42> <EFBFBD> ͐<EFBFBD> <CD90> <EFBFBD> <EFBFBD> B< BR >
2003-03-28 00:00:21 -05:00
c = a.power(n)< BR >
<EFBFBD> <EFBFBD> <EFBFBD> ʂƂ<EFBFBD> <EFBFBD> <EFBFBD> c <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> a <20> <> n <20> {<7B> ȏ<EFBFBD> <C88F> ɂȂ<C982> <C882> ̂Œ<CC82> <C592> ӁB
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-07-18 11:23:23 -04:00
< LI > < B > sqrt< / B > < / LI > < BLOCKQUOTE >
a<EFBFBD> ̗L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> n <20> <> <EFBFBD> ̕<EFBFBD> <CC95> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> in <20> ̕<EFBFBD> <CC95> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł͂<C582> <CD82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> j<EFBFBD> <6A>
<EFBFBD> j<EFBFBD> <EFBFBD> <EFBFBD> [<5B> g<EFBFBD> <67> <EFBFBD> @<40> Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
c = a.sqrt(n)< BR >
< / BLOCKQUOTE >
2003-06-27 00:38:57 -04:00
2003-08-01 00:48:32 -04:00
< LI > < B > divmod,quo,modulo,%,remainder< / B > < / LI > < BLOCKQUOTE >
<EFBFBD> ڍׂ͑Ή<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Float <20> ̊e<CC8A> <65> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> <68> <EFBFBD> Q<EFBFBD> Ƃ<EFBFBD> <C682> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< / BLOCKQUOTE >
2003-06-27 00:38:57 -04:00
< LI > < B > & lt=& gt< / B > < / LI > < BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
a==b <20> Ȃ<EFBFBD> 0<> Aa & gt b <20> Ȃ<EFBFBD> 1<> Aa & lt b <20> Ȃ<EFBFBD> -1 <20> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B< BR >
2011-05-22 05:26:02 -04:00
c = a & lt=& gt b
2003-06-27 00:38:57 -04:00
< / BLOCKQUOTE >
2003-03-28 00:00:21 -05:00
< / UL >
<EFBFBD> <EFBFBD> <EFBFBD> ́A<EFBFBD> ǂ<EFBFBD> <EFBFBD> Ŏ<EFBFBD> <EFBFBD> ̔@<40> <> <EFBFBD> ł<EFBFBD> <C582> B< BR >
< UL >
2003-06-27 00:38:57 -04:00
< LI > < B > ==< / B > < / LI >
< LI > < B > ===< / B > < / LI >
2003-03-28 00:00:21 -05:00
<EFBFBD> u==<3D> v<EFBFBD> Ɠ<EFBFBD> <C693> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> <EFBFBD> case <20> <> <EFBFBD> Ŏg<C58E> p<EFBFBD> <70> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-06-27 00:38:57 -04:00
< LI > < B > !=< / B > < / LI >
< LI > < B > & lt< / B > < / LI >
< LI > < B > & lt=< / B > < / LI >
< LI > < B > & gt< / B > < / LI >
< LI > < B > & gt=< / B > < / LI >
2003-03-28 00:00:21 -05:00
< / UL >
2003-07-18 11:23:23 -04:00
2003-03-28 00:00:21 -05:00
< H3 > coerce<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / H3 >
BigDecimal <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <67> <EFBFBD> Z<EFBFBD> p<EFBFBD> <70> <EFBFBD> Z<EFBFBD> q<EFBFBD> ̍<EFBFBD> <CC8D> ɂ<EFBFBD> <C982> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ́ABigDecimal <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <67>
<EFBFBD> E<EFBFBD> ɂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <EFBFBD> (<28> K<EFBFBD> v<EFBFBD> Ȃ<EFBFBD> ) BigDecimal <20> ɕϊ<C995> <CF8A> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> ]<5D> <> <EFBFBD> āABigDecimal <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> ȊO<C88A> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> l<EFBFBD> <6C> <EFBFBD> Ӗ<EFBFBD> <D396> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂Ȃ<CC82> <C882> E<EFBFBD> ɒu<C992> <75> <EFBFBD> <EFBFBD>
2003-07-18 11:23:23 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> ͉ \<5C> ł<EFBFBD> <C582> B< BR >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́i<EFBFBD> ʏ <EFBFBD> <EFBFBD> j<EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> Ɏ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 邱<EFBFBD> Ƃ͂ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2003-11-04 09:10:09 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 𐔒l<EFBFBD> Ɏ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EFBFBD> bigfloat.c <20> <>
2003-07-18 11:23:23 -04:00
<EFBFBD> u/* #define ENABLE_NUMERIC_STRING */<2F> v<EFBFBD> ̃R<CC83> <52> <EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> <67> <EFBFBD> O<EFBFBD> <4F> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> A
<EFBFBD> ăR<EFBFBD> <EFBFBD> <EFBFBD> p<EFBFBD> C<EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> ăC<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> g<EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> K<EFBFBD> v<EFBFBD> <76> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ő<EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> ^<5E> <> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> ͒<EFBFBD> <CD92> ӂ<EFBFBD> <D382> K<EFBFBD> v<EFBFBD> ł<EFBFBD> <C582> B<EFBFBD> <42> <EFBFBD> l<EFBFBD> ɕϊ<C995> <CF8A> ł<EFBFBD> <C582> Ȃ<EFBFBD> <C882> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƁA
<EFBFBD> P<EFBFBD> ɕϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ~<7E> ߂邾<DF82> <E982BE> <EFBFBD> ŃG<C583> <47> <EFBFBD> [<5B> ɂ͂Ȃ<CD82> <C882> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B"10XX"<22> Ȃ<EFBFBD> <C882> P<EFBFBD> O<EFBFBD> A"XXXX"<22> ͂O
<EFBFBD> ƈ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR >
< CODE > < PRE >
a = BigDecimal.E(20)
c = a * "0.123456789123456789123456789" # <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BigDecimal <20> ɕϊ<C995> <CF8A> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> v<EFBFBD> Z
< / PRE > < / CODE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> āA"Infinity"<22> A"+Infinity"<22> A"-Infinity"<22> A"NaN"
<EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> p<EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> (<28> 啶<EFBFBD> <E595B6> <EFBFBD> E<EFBFBD> <45> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʂ<EFBFBD> <CA82> ܂ <EFBFBD> )<29> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Amode <20> <> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> <68> false <20> <>
<EFBFBD> w<EFBFBD> 肵<EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> ͗<EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< BR >
<EFBFBD> ܂ <EFBFBD> <EFBFBD> ABigDecimal<EFBFBD> N<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> coerce<63> iRuby<62> {<7B> Q<EFBFBD> Ɓj<C681> <6A> <EFBFBD> T<EFBFBD> |<7C> [<5B> g<EFBFBD> <67> <EFBFBD> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> B
<EFBFBD> ]<5D> <> <EFBFBD> āABigDecimal <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <67> <EFBFBD> E<EFBFBD> ɂ<EFBFBD> <C982> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EA8D87> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͑<EFBFBD> <CD91> <EFBFBD> <EFBFBD> v<EFBFBD> ł<EFBFBD> <C582> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> ݂<EFBFBD> Ruby <20> C<EFBFBD> <43> <EFBFBD> ^<5E> v<EFBFBD> <76> <EFBFBD> ^<5E> ̎d<CC8E> l<EFBFBD> <6C> <EFBFBD> A<EFBFBD> <41> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <F182AA8D> ɂ<EFBFBD> <C982> <EFBFBD> <EFBFBD> ƌv<C68C> Z<EFBFBD> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B< BR >
< CODE > < PRE >
a = BigDecimal.E(20)
c = "0.123456789123456789123456789" * a # <20> G<EFBFBD> <47> <EFBFBD> [
< / PRE > < / CODE >
<EFBFBD> K<EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ͎v<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> A<EFBFBD> ǂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ƌ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD>
String <20> I<EFBFBD> u<EFBFBD> W<EFBFBD> F<EFBFBD> N<EFBFBD> g<EFBFBD> <67> <EFBFBD> p<EFBFBD> <70> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> V<EFBFBD> <56> <EFBFBD> ȃN<C883> <4E> <EFBFBD> X<EFBFBD> <58> <EFBFBD> 쐬<EFBFBD> <EC90AC> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> A
<EFBFBD> <EFBFBD> <EFBFBD> ̃N<EFBFBD> <EFBFBD> <EFBFBD> X<EFBFBD> <EFBFBD> coerce <20> <> <EFBFBD> T<EFBFBD> |<7C> [<5B> g<EFBFBD> <67> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< hr >
< A NAME = "#UNDEF" >
< H2 > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> A<EFBFBD> [<5B> <> <EFBFBD> ̈<EFBFBD> <CC88> <EFBFBD> < / H2 >
<EFBFBD> u<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Ƃ͕\<5C> <> <EFBFBD> ł<EFBFBD> <C582> Ȃ<EFBFBD> <C882> <EFBFBD> <EFBFBD> 炢<EFBFBD> 傫<EFBFBD> Ȑ<EFBFBD> <C890> ł<EFBFBD> <C582> B<EFBFBD> <42> <EFBFBD> ʂɈ<CA82> <C988> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ߂<EFBFBD>
+Infinity<74> i<EFBFBD> <69> <EFBFBD> ̖<EFBFBD> <CC96> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j<EFBFBD> <6A> -Infinity<74> i<EFBFBD> <69> <EFBFBD> ̖<EFBFBD> <CC96> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j<EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD>
<EFBFBD> 悤<EFBFBD> ɕ\<5C> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1.0/0.0 <20> ̂悤<CC82> Ƀ[<5B> <> <EFBFBD> Ŋ<EFBFBD> <C58A> <EFBFBD> <EFBFBD> 悤<EFBFBD> Ȍv<C88C> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ɐ<EFBFBD> <C990> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
< BR > < BR >
<EFBFBD> u<EFBFBD> v<EFBFBD> <EFBFBD> 0.0/0.0 <20> <> Infinity-Infinity <20> <> <EFBFBD> ̌<EFBFBD> <CC8C> ʂ<EFBFBD> <CA82> <EFBFBD> <EFBFBD> `<60> ł<EFBFBD> <C582> Ȃ<EFBFBD>
<EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <EFBFBD> ɐ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> NaN<61> iNot a Number<65> j<EFBFBD> ƕ\<5C> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
NaN <20> <> <EFBFBD> ܂ ތv<DE8C> Z<EFBFBD> ͑S<CD91> <53> NaN <20> ɂȂ<C982> <C882> ܂ <EFBFBD> <DC82> B<EFBFBD> ܂ <EFBFBD> NaN <20> ͎<EFBFBD> <CD8E> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ ߂āA<C481> ǂ<EFBFBD> <C782> Ȑ<EFBFBD>
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< BR > < BR >
<EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> +0.0 <20> <> -0.0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ݂<EFBFBD> <DD82> ܂ <EFBFBD> <DC82> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A+0.0==-0.0 <20> <> true <20> ł<EFBFBD> <C582> B
< BR > < BR >
Infinity<EFBFBD> ANaN<EFBFBD> A +0.0 <20> <> -0.0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ܂ v<F182BE8C> Z<EFBFBD> <5A> <EFBFBD> ʂ͑g<CD91> ݍ<EFBFBD> <DD8D> 킹<EFBFBD> <ED82B9>
<EFBFBD> <EFBFBD> <EFBFBD> 蕡<EFBFBD> G<EFBFBD> ł<EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ́A<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̃v<EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> Č<EFBFBD> <EFBFBD> ʂ<EFBFBD>
<EFBFBD> m<EFBFBD> F<EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> ʂɂ <EFBFBD> <EFBFBD> āA<EFBFBD> ^<5E> <> <EFBFBD> <EFBFBD> <EFBFBD> ԈႢ<D488> <EFBFBD> <F094AD8C> <EFBFBD> <EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> m<EFBFBD> 点<EFBFBD> 肢<EFBFBD> ܂ <EFBFBD> <EFBFBD> j<EFBFBD> B
< PRE >
< CODE >
require "bigdecimal"
aa = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
ba = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
opa = %w(+ - * / < => > >= < == != < =)
for a in aa
for b in ba
for op in opa
x = BigDecimal::new(a)
y = BigDecimal::new(b)
eval("ans= x #{op} y;print a,' ',op,' ',b,' ==> ',ans.to_s,\"\n\"")
end
end
end
< / CODE >
< / PRE >
< hr >
< A NAME = "#STRUCT" >
< H2 > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> < / H2 >
BigDecimal<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŕ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> ͍\<5C> <> <EFBFBD> <EFBFBD> (Real)<29> ŕ\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> ̂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> unsigned long <20> ̔z<CC94> <7A> (<28> ȉ<EFBFBD> <C889> ̍\<5C> <> <EFBFBD> ̗v<CC97> ffrac)<29> ŊǗ<C58A> <C797> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> T<EFBFBD> O<EFBFBD> I<EFBFBD> ɂ́A<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> ɂȂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR > < BR >
< <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> > = 0.xxxxxxxxx*BASE**n< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŁAx<EFBFBD> ͉<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ABASE<53> ͊<CD8A> i<EFBFBD> P<EFBFBD> O<EFBFBD> i<EFBFBD> Ȃ<EFBFBD> <C882> P<EFBFBD> O<EFBFBD> j<EFBFBD> An<41> ͎w<CD8E> <77> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \<5C> <>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ł<EFBFBD> <EFBFBD> BBASE<EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <EFBFBD> <EFBFBD> قǁA<EFBFBD> 傫<EFBFBD> Ȑ<EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B<EFBFBD> ܂ <C282> <DC82> A<EFBFBD> z<EFBFBD> <7A> <EFBFBD> ̃T<CC83> C<EFBFBD> Y<EFBFBD> <59>
<EFBFBD> <EFBFBD> <EFBFBD> Ȃ<EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> BBASE<EFBFBD> ͑傫<EFBFBD> <EFBFBD> <EFBFBD> قǓs<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 悢<EFBFBD> 킯<EFBFBD> ł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> f<EFBFBD> o<EFBFBD> b<EFBFBD> O<EFBFBD> ̂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ₷<EFBFBD> <EFBFBD> <EFBFBD> Ȃǂ<EFBFBD>
<EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> āA10000<EFBFBD> ɂȂ<EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> iBASE<EFBFBD> <EFBFBD> VpInit()<29> <EFBFBD> <D690> Ŏ<EFBFBD> <C58E> <EFBFBD> <EFBFBD> I<EFBFBD> Ɍv<C98C> Z<EFBFBD> <5A> <EFBFBD> ܂ <EFBFBD> <DC82> j<EFBFBD> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́A32<EFBFBD> r<EFBFBD> b<EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̏ꍇ<EFBFBD> ł<EFBFBD> <EFBFBD> B64<EFBFBD> r<EFBFBD> b<EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̏ꍇ<EFBFBD> ͂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƒ傫<EFBFBD> Ȓl<EFBFBD> ɂȂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
<EFBFBD> c<EFBFBD> O<EFBFBD> Ȃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A64<EFBFBD> r<EFBFBD> b<EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł̃e<EFBFBD> X<EFBFBD> g<EFBFBD> ͂܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꂽ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> ʂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 肪<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> j<EFBFBD> B
BASE<EFBFBD> <EFBFBD> 10000<EFBFBD> ̂Ƃ<EFBFBD> <EFBFBD> ́A<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̉<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̔z<EFBFBD> <EFBFBD> (frac)<29> ̊e<CC8A> v<EFBFBD> f<EFBFBD> ɂ͍ő<CD8D> <C591> łS<C582> <53> <EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> (Real)<29> ͈ȉ<CD88> <C889> ̂悤<CC82> ɂȂ<C982> <C882> Ă<EFBFBD> <C482> ܂ <EFBFBD> <DC82> B
< BR >
< CODE > < PRE >
typedef struct {
unsigned long MaxPrec; // <20> ő吸<C591> x(frac[]<5D> ̔z<CC94> <7A> <EFBFBD> T<EFBFBD> C<EFBFBD> Y)
unsigned long Prec; // <20> <> <EFBFBD> x(frac[]<5D> ̎g<CC8E> p<EFBFBD> T<EFBFBD> C<EFBFBD> Y)
short sign; // <20> ȉ<EFBFBD> <C889> ̂悤<CC82> ɕ<EFBFBD> <C995> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̏<EFBFBD> <CC8F> Ԃ<EFBFBD> <D482> <EFBFBD> <EFBFBD> `<60> <> <EFBFBD> ܂ <EFBFBD> <DC82> B
// ==0 : NaN
// 1 : +0
// -1 : -0
// 2 : <20> <> <EFBFBD> ̒l
// -2 : <20> <> <EFBFBD> ̒l
// 3 : +Infinity
// -3 : -Infinity
unsigned short flag; // <20> e<EFBFBD> <65> <EFBFBD> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> t<EFBFBD> <74> <EFBFBD> b<EFBFBD> O
int exponent; // <20> w<EFBFBD> <77> <EFBFBD> <EFBFBD> <EFBFBD> ̒l(<28> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> *BASE**exponent)
unsigned long frac[1]; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̔z<CC94> <7A> (<28> <EFBFBD> )
} Real;
< / CODE > < / PRE >
<EFBFBD> Ⴆ<EFBFBD> <EFBFBD> 1234.56784321 <20> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> (BASE=10000<30> Ȃ<EFBFBD> )< BR >
< PRE >
0.1234 5678 4321*(10000)**1
< / PRE >
<EFBFBD> ł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> frac[0]=1234<33> Afrac[1]=5678<37> Afrac[2]=4321<32> A
Prec=3<> Asign=2<> Aexponent=1 <20> ƂȂ<C682> <C882> ܂ <EFBFBD> <DC82> BMaxPrec<65> <63>
Prec <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <CE82> <EFBFBD> <EFBFBD> ł<C282> <C582> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> Bflag <20> <>
<EFBFBD> g<EFBFBD> p<EFBFBD> <EFBFBD> <EFBFBD> @<40> ͎<EFBFBD> <CD8E> <EFBFBD> <EFBFBD> Ɉˑ<C988> <CB91> <EFBFBD> <EFBFBD> ē<EFBFBD> <C493> <EFBFBD> <EFBFBD> Ŏg<C58E> p<EFBFBD> <70> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
< hr >
< A NAME = "#BASE" >
< H2 > 2<EFBFBD> i<EFBFBD> <EFBFBD> 10<EFBFBD> i< / H2 >
BigDecimal <20> <> < <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> > = 0.xxxxxxxxx*10**n <20> Ƃ<EFBFBD> <C682> <EFBFBD> 10<31> i<EFBFBD> `<60> <> <EFBFBD> Ő<EFBFBD> <C590> l<EFBFBD> <6C> <EFBFBD> ێ<EFBFBD> <DB8E> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> v<EFBFBD> Z<EFBFBD> @<40> ̕<EFBFBD> <CC95> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <5F> <EFBFBD> ̓<EFBFBD> <CC93> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> ́A<CD81> <41> <EFBFBD> <EFBFBD> <EFBFBD> ܂ ł<DC82> <C582> Ȃ<EFBFBD> < <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> > = 0.bbbbbbbb*2**n <20> Ƃ<EFBFBD> <C682> <EFBFBD>
2<EFBFBD> i<EFBFBD> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʂł<CA82> (x <20> <> 0 <20> <> <EFBFBD> <EFBFBD> 9 <20> ܂ ŁAb <20> <> 0 <20> <> 1 <20> ̐<EFBFBD> <CC90> <EFBFBD> )<29> B
BigDecimal <20> <> <EFBFBD> Ȃ<EFBFBD> 10<31> i<EFBFBD> ̓<EFBFBD> <CC93> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> <EFBFBD> ̗p<CC97> <70> <EFBFBD> <EFBFBD> <EFBFBD> ̂<EFBFBD> <CC82> <EFBFBD> <EFBFBD> ȉ<EFBFBD> <C889> ɐ<EFBFBD> <C990> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
< H4 > 10<EFBFBD> i<EFBFBD> ̃<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> g< / H4 >
< DL >
< DT > <EFBFBD> f<EFBFBD> o<EFBFBD> b<EFBFBD> O<EFBFBD> ̂<EFBFBD> <EFBFBD> ₷<EFBFBD> <EFBFBD>
< DD > <EFBFBD> ܂ <EFBFBD> <EFBFBD> A<EFBFBD> v<EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 쐬<EFBFBD> <EFBFBD> <EFBFBD> y<EFBFBD> ł<EFBFBD> <EFBFBD> Bfrac[0]=1234<33> Afrac[1]=5678<37> Afrac[2]=4321<32> A
exponent=1<> Asign=2 <20> Ȃ琔<C882> l<EFBFBD> <6C> 1234.56784321 <20> ł<EFBFBD> <C582> <EFBFBD> <EFBFBD> ̂͌<CC82> <CD8C> <EFBFBD> <EFBFBD> Β <EFBFBD> <CE92> <EFBFBD> <EFBFBD> ɕ<EFBFBD> <C995> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
< DT > 10<EFBFBD> i<EFBFBD> \<5C> L<EFBFBD> <4C> <EFBFBD> ꂽ<EFBFBD> <EA82BD> <EFBFBD> l<EFBFBD> Ȃ<EFBFBD> <C882> m<EFBFBD> <6D> <EFBFBD> ɓ<EFBFBD> <C993> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> ɕϊ<C995> <CF8A> ł<EFBFBD> <C582> <EFBFBD>
< DD > <EFBFBD> Ⴆ<EFBFBD> A<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> ȃv<EFBFBD> <EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͑S<EFBFBD> <EFBFBD> <EFBFBD> 덷<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
<EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̗<EFBFBD> <EFBFBD> ́A<EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> Ɉ<EFBFBD> <EFBFBD> ̐<EFBFBD> <EFBFBD> l
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> t<EFBFBD> @<40> C<EFBFBD> <43> file <20> ̍<EFBFBD> <CC8D> v<EFBFBD> <76> <EFBFBD> l<EFBFBD> <6C> <EFBFBD> <EFBFBD> <EFBFBD> ߂<EFBFBD> <DF82> <EFBFBD> <EFBFBD> ̂ł<CC82> <C582> B
2003-07-22 10:04:23 -04:00
< CODE > < PRE >
2003-03-28 00:00:21 -05:00
file = File::open(....,"r")
s = BigDecimal::new("0")
while line = file.gets
s = s + line
end
2003-07-22 10:04:23 -04:00
< / PRE > < / CODE >
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> ̗<EFBFBD> <EFBFBD> <EFBFBD> 2<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ƌ덷<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 荞<EFBFBD> މ \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> Ⴆ<EFBFBD> <EFBFBD> 0.1 <20> <> 2<EFBFBD> i<EFBFBD> ŕ\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 0.1 = b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....
<EFBFBD> Ɩ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɑ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> ܂ <EFBFBD> (b1=0,b2=0,b3=0,b4=1...)<29> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> bn(n=1,2,3,...) <20> <>
2<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 0 <20> <> 1 <20> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <C582> B<EFBFBD> ]<5D> <> <EFBFBD> āA<C481> ǂ<EFBFBD> <C782> <EFBFBD> <EFBFBD> őł<C591> <C582> <EFBFBD> <D882> K<EFBFBD> v<EFBFBD> <76> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ŕϊ<EFBFBD> <EFBFBD> 덷<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ēx10<EFBFBD> i<EFBFBD> \<5C> L<EFBFBD> ɂ<EFBFBD> <C982> Ĉ<EFBFBD> <C488> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> <E682A4>
<EFBFBD> ꍇ<EFBFBD> ͓K<EFBFBD> Ȋۂߑ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> l<EFBFBD> ̌ܓ<EFBFBD> <EFBFBD> j<EFBFBD> ɂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> čĂ<EFBFBD> "0.1" <20> ƕ\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł͐<EFBFBD> <EFBFBD> m<EFBFBD> <EFBFBD> 0.1 <20> ł͂<C582> <CD82> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B
< DT > <EFBFBD> L<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͗L<EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> i<EFBFBD> ܂ 莩<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j
< DD > 0.1 <20> <> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> 邽<EFBFBD> ߂̗̈<CC97> <CC88> ͂<EFBFBD> <CD82> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̔z<CC94> <7A> <EFBFBD> v<EFBFBD> f<EFBFBD> i frac[0]=1 <20> j<EFBFBD> ōς݂܂ <DD82> <DC82> B
<EFBFBD> z<EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> f<EFBFBD> ̐<EFBFBD> <EFBFBD> <EFBFBD> 10<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> <EFBFBD> 玩<EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> Ɍ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ́A<EFBFBD> ϒ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> _<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> ł<EFBFBD>
<EFBFBD> 厖<EFBFBD> Ȃ<EFBFBD> <EFBFBD> Ƃł<EFBFBD> <EFBFBD> B<EFBFBD> t<EFBFBD> <EFBFBD> 0.1 <20> <> 2<EFBFBD> i<EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ɂ<EFBFBD> 2<EFBFBD> i<EFBFBD> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɂ<C282> <C982> <EFBFBD> <EFBFBD> ̂<EFBFBD> 0.1 <20> <>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł͌<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< / DL >
< H3 > 10<EFBFBD> i<EFBFBD> ̃f<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> g< / H3 >
<EFBFBD> <EFBFBD> <EFBFBD> ͍<EFBFBD> <EFBFBD> ܂ ł̃<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> g<EFBFBD> ́A<EFBFBD> <EFBFBD> <EFBFBD> ̂܂ ܃ f<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> g<EFBFBD> ɂ<EFBFBD> <EFBFBD> Ȃ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2004-02-19 23:13:30 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> A10<EFBFBD> i<EFBFBD> <EFBFBD> 2<EFBFBD> i<EFBFBD> ɕϊ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> ȑ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ͕ϊ<EFBFBD> <EFBFBD> 덷
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 邱<EFBFBD> Ƃ͂ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
2004-02-19 23:13:30 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> T<EFBFBD> ̃R<EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <EFBFBD> <EFBFBD> [<5B> ^<5E> <> 10<31> i<EFBFBD> ̓<EFBFBD> <CC93> <EFBFBD> <EFBFBD> \<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> Ȃ<EFBFBD> <C882> ̂ŁA
BigDecimal <20> 𗘗p<F0979897> <70> <EFBFBD> Č덷<C48C> <EB8DB7> <EFBFBD> <EFBFBD> <EFBFBD> ̌v<CC8C> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> ́A<CD81> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> x
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <EFBFBD> Ō<EFBFBD> <EFBFBD> ܂ <EFBFBD> BigDecimal <20> <> <EFBFBD> g<EFBFBD> p<EFBFBD> <70> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> K<EFBFBD> v<EFBFBD> <76> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
2003-03-28 00:00:21 -05:00
< H3 > <EFBFBD> ŏ<EFBFBD> <EFBFBD> ͉<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> H< / H3 >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ōv<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <EFBFBD> ɂ킴<EFBFBD> 킴2<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> ͋ɂ߂Ă܂ <EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> B
<EFBFBD> v<EFBFBD> Z<EFBFBD> @<40> Ƀf<C983> [<5B> ^<5E> <> <EFBFBD> <EFBFBD> <EFBFBD> ͂<EFBFBD> <CD82> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> قƂ<D982> <C682> ǂ̏ꍇ<CC8F> A
10<EFBFBD> i<EFBFBD> <EFBFBD> <EFBFBD> œ<EFBFBD> <EFBFBD> ͂<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B<EFBFBD> <EFBFBD> <EFBFBD> ̌<EFBFBD> <EFBFBD> ʁAdouble <20> <> <EFBFBD> ̌v<CC8C> Z<EFBFBD> @<40> <> <EFBFBD> <EFBFBD>
<EFBFBD> \<5C> <> <EFBFBD> ͍ŏ<CD8D> <C58F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 덷<EFBFBD> <EB8DB7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ă<EFBFBD> <C482> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EA8D87> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
BigDecimal <20> ̓<EFBFBD> <CD83> [<5B> U<EFBFBD> <55> <EFBFBD> ͂<EFBFBD> <CD82> 덷<EFBFBD> <EB8DB7> <EFBFBD> <EFBFBD> <EFBFBD> Ŏ<EFBFBD> <C58E> 荞<EFBFBD> ނ<EFBFBD> <DE82> Ƃ<EFBFBD> <C682> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
<EFBFBD> f<EFBFBD> o<EFBFBD> b<EFBFBD> O<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ₷<EFBFBD> <EFBFBD> <EFBFBD> ̂ƁA<EFBFBD> f<EFBFBD> [<5B> ^<5E> ǂ݂<C782> <DD82> ݎ<EFBFBD> <DD8E> Ɍ덷<C98C> <EB8DB7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ȃ<EFBFBD>
<EFBFBD> Ƃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ۂ̃<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> g<EFBFBD> ł<EFBFBD> <EFBFBD> B
< hr >
< A NAME = "#PREC" >
< H2 > <EFBFBD> v<EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> ɂ <EFBFBD> <EFBFBD> <EFBFBD> < / H2 >
c = a op b <20> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> v<EFBFBD> Z(op <20> <> + - * /)<29> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> ̓<EFBFBD> <CC93> <EFBFBD> <EFBFBD> <EFBFBD>
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̂悤<EFBFBD> ɂȂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B< BR > < BR >
2003-07-22 10:04:23 -04:00
<EFBFBD> P<EFBFBD> D<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> (a <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )+(b <20> ̗L<CC97> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )<29> A
<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> (a <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )+(b <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )<29> <> <EFBFBD> ̍ő包<C591> <E58C85> <EFBFBD> i<EFBFBD> <69> <EFBFBD> ۂ́A<CD81> ]<5D> T<EFBFBD> <54> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> āA
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <EFBFBD> <EFBFBD> Ȃ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> j<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϐ<EFBFBD> c <20> <> <EFBFBD> V<EFBFBD> <56> <EFBFBD> ɐ<EFBFBD> <C990> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> ̏ꍇ<EFBFBD> ́A<EFBFBD> 덷<EFBFBD> <EFBFBD> <EFBFBD> o<EFBFBD> Ȃ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̐<EFBFBD> <EFBFBD> x<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> c <20> <EFBFBD> <F090B690> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B<EFBFBD> Ⴆ<EFBFBD> <E182A6>
c = 0.1+0.1*10**(-100) <20> ̂悤<CC82> ȏꍇ<C88F> Ac <20> ̐<EFBFBD> <CC90> x<EFBFBD> ͂P<CD82> O<EFBFBD> O<EFBFBD> <4F> <EFBFBD> ȏ<EFBFBD> <C88F> ̐<EFBFBD> <CC90> x<EFBFBD> <78>
<EFBFBD> <EFBFBD> <EFBFBD> 悤<EFBFBD> ɂȂ<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
2003-07-24 22:26:56 -04:00
< BR > < BR >
2003-03-28 00:00:21 -05:00
<EFBFBD> Q<EFBFBD> D<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> c = a op b <20> ̌v<CC8C> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <73> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> ̂悤<EFBFBD> Ɂ A<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> Ə<EFBFBD> <EFBFBD> Z<EFBFBD> ł<EFBFBD> c <20> ͕K<CD95> <4B> <EFBFBD> u<EFBFBD> 덷<EFBFBD> <EB8DB7> <EFBFBD> o<EFBFBD> Ȃ<EFBFBD> <C882> v<EFBFBD> <76> <EFBFBD> <EFBFBD> <EFBFBD> ̐<EFBFBD> <CC90> x<EFBFBD> <78>
2003-07-24 22:26:56 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Đ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> (BigDecimal.limit <20> <> <EFBFBD> w<EFBFBD> 肵<EFBFBD> Ȃ<EFBFBD> <C882> ꍇ)<29> B
<EFBFBD> <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> (a <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )+(b <20> ̍ő<CC8D> <C591> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )<29> <> <EFBFBD> ̍ő包<C591> <E58C85>
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> c <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> Ac = 1.0/3.0 <20> ̂悤<CC82> Ȍv<C88C> Z<EFBFBD> Ŗ<EFBFBD> <C596> 炩<EFBFBD> Ȃ悤<C882> Ɂ A
c <20> ̍ő吸<C591> x<EFBFBD> <EFBFBD> <F092B482> <EFBFBD> <EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD> <EFBFBD> Ōv<C58C> Z<EFBFBD> <5A> <EFBFBD> ł<EFBFBD> <C582> <EFBFBD> <D882> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EA8D87> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɂ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ac <20> ̍ő吸<C591> x<EFBFBD> <78> a <20> <> b <20> <> <EFBFBD> <EFBFBD> <EFBFBD> 傫<EFBFBD> <E582AB> <EFBFBD> Ȃ<EFBFBD> <C882> ܂ <EFBFBD> <DC82> ̂<EFBFBD> c <20> <> <EFBFBD> K<EFBFBD> v<EFBFBD> Ƃ<EFBFBD> <C682> <EFBFBD>
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [<5B> ̈<EFBFBD> <CC88> ͑傫<CD91> <E582AB> <EFBFBD> Ȃ邱<C882> Ƃɒ<C682> <C992> ӂ<EFBFBD> <D382> ĉ<EFBFBD> <C489> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> B
< BR > < BR >
<EFBFBD> <EFBFBD> <EFBFBD> ӁF<EFBFBD> u+,-,*,/<2F> v<EFBFBD> ł͌<C582> <CD8C> ʂ̐<CA82> <CC90> x<EFBFBD> i<EFBFBD> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j<EFBFBD> <6A> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŏw<C58E> <77> <EFBFBD> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> <EFBFBD> <EFBFBD> B
2003-07-24 22:26:56 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> x<EFBFBD> <EFBFBD> <EFBFBD> R<EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> ́A<CD81> ȉ<EFBFBD> <C889> ̃C<CC83> <43> <EFBFBD> X<EFBFBD> ^<5E> <> <EFBFBD> X<EFBFBD> <58> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> <68> <EFBFBD> g<EFBFBD> p<EFBFBD> <70> <EFBFBD> ܂ <EFBFBD> <DC82> B< BR >
< UL >
< LI > add,sub,mult,div< / LI > < BLOCKQUOTE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̃<EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> ͐擪(<28> ō<EFBFBD> )<29> ̐<EFBFBD> <CC90> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̌<EFBFBD> <CC8C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> w<EFBFBD> <77> <EFBFBD> ł<EFBFBD> <C582> ܂ <EFBFBD> <DC82> B
< CODE > < PRE >
BigDecimal("2").div(3,12) # 2.0/3.0 => 0.6666666666 67E0
< / PRE > < / CODE >
< / BLOCKQUOTE >
< LI > truncate,round,ceil,floor< / LI > < BLOCKQUOTE >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̃<EFBFBD> <EFBFBD> \<5C> b<EFBFBD> h<EFBFBD> ͏ <EFBFBD> <CD8F> <EFBFBD> <EFBFBD> _<EFBFBD> <5F> <EFBFBD> <EFBFBD> <EFBFBD> ̑<EFBFBD> <CC91> Έʒu<CA92> <75> <EFBFBD> w<EFBFBD> 肵<EFBFBD> Č<EFBFBD> <C48C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 肵<EFBFBD> ܂ <EFBFBD> <DC82> B
< CODE > < PRE >
BigDecimal("6.66666666666666").round(12) # => 0.6666666666 667E1
< / PRE > < / CODE >
< / BLOCKQUOTE >
< / UL >
2003-03-28 00:00:21 -05:00
< H3 > <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ő<EFBFBD> <EFBFBD> x<EFBFBD> <EFBFBD> <EFBFBD> R<EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> <EFBFBD> <EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ< / H3 >
2003-07-24 22:26:56 -04:00
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ő<EFBFBD> <EFBFBD> x(<28> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )<29> <> <EFBFBD> R<EFBFBD> <52> <EFBFBD> g<EFBFBD> <67> <EFBFBD> [<5B> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ꍇ<EFBFBD> <EA8D87> add<64> Asub<75> Amult<6C> Adiv <20> <> <EFBFBD> ̃<EFBFBD> <CC83> \<5C> b<EFBFBD> h
2003-03-28 00:00:21 -05:00
<EFBFBD> <EFBFBD> <EFBFBD> g<EFBFBD> p<EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
<EFBFBD> ȉ<EFBFBD> <EFBFBD> ̉~<7E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> Z<EFBFBD> <5A> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> <76> <EFBFBD> O<EFBFBD> <4F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ̂悤<CC82> Ɂ A
<EFBFBD> <EFBFBD> <EFBFBD> ߂錅<EFBFBD> <EFBFBD> <EFBFBD> ͎<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŏw<EFBFBD> 肷<EFBFBD> 邱<EFBFBD> Ƃ<EFBFBD> <EFBFBD> ł<EFBFBD> <EFBFBD> ܂ <EFBFBD> <EFBFBD> B
< BR > < BR >
< CODE > < PRE >
#!/usr/local/bin/ruby
require "bigdecimal"
#
2003-07-24 22:26:56 -04:00
# Calculates 3.1415.... (the number of times that a circle's diameter
# will fit around the circle) using J. Machin's formula.
2003-03-28 00:00:21 -05:00
#
2003-05-06 09:18:26 -04:00
def big_pi(sig) # sig: Number of significant figures
2003-03-28 00:00:21 -05:00
exp = -sig
pi = BigDecimal::new("0")
two = BigDecimal::new("2")
m25 = BigDecimal::new("-0.04")
m57121 = BigDecimal::new("-57121")
u = BigDecimal::new("1")
k = BigDecimal::new("1")
w = BigDecimal::new("1")
t = BigDecimal::new("-80")
2011-05-22 05:26:02 -04:00
while (u.nonzero? & & u.exponent >= exp)
2003-03-28 00:00:21 -05:00
t = t*m25
2003-07-24 22:26:56 -04:00
u = t.div(k,sig)
2003-03-28 00:00:21 -05:00
pi = pi + u
k = k+two
end
u = BigDecimal::new("1")
k = BigDecimal::new("1")
w = BigDecimal::new("1")
t = BigDecimal::new("956")
2003-07-24 22:26:56 -04:00
while (u.nonzero? & & u.exponent >= exp )
t = t.div(m57121,sig)
u = t.div(k,sig)
2003-03-28 00:00:21 -05:00
pi = pi + u
k = k+two
end
pi
end
if $0 == __FILE__
2003-07-24 22:26:56 -04:00
if ARGV.size == 1
print "PI("+ARGV[0]+"):\n"
p big_pi(ARGV[0].to_i)
else
print "TRY: ruby pi.rb 1000 \n"
end
2003-03-28 00:00:21 -05:00
end
< / PRE > < / CODE >
< HR >
< FONT size = 2 >
< I >
< A HREF = "http://www.tinyforest.gr.jp" >
<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> Η Y
< / A >
(E-Mail:< A HREF = "mailto:shigeo@tinyforest.gr.jp" > & ltshigeo@tinyforest.gr.jp& gt< / U > < / A > )
< / I >
< / FONT >
< / TD >
< / TR >
< / TABLE >
< / BODY >
< / HTML >