[#8820] BEGIN as stmt. ? — EGUCHI Osamu <eguchi@...>
えぐち@エスアンドイーです。
5 messages
2000/01/04
[#8824] [REQ] Integer#{hex,dec,oct,bin}, String#bin — gotoken@... (GOTO Kentaro)
ごとけんです
38 messages
2000/01/05
[#8839] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/01/06
まつもと ゆきひろです
[#8842] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/01/06
ごとけんです
[#8843] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/01/06
まつもと ゆきひろです
[#8844] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/01/06
ごとけんです
[#8857] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— keiju@... (石塚圭樹)
2000/01/06
けいじゅ@日本ラショナルソフトウェアです.
[#8846] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/01/06
まつもと ゆきひろです
[#8847] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/01/06
ごとけんです
[#8890] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— Koji Arai <JCA02266@...>
2000/01/08
新井です。
[#8914] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/01/12
まつもと ゆきひろです
[#8968] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— Koji Arai <JCA02266@...>
2000/01/19
新井です。
[#8976] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— WATANABE Hirofumi <Hirofumi.Watanabe@...>
2000/01/20
わたなべです.
[#9041] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/01/29
まつもと ゆきひろです
[#9045] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/01/30
ごとけんです
[#9061] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/02/02
ごとけんです
[#9077] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/02/04
まつもと ゆきひろです
[#9114] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/02/04
ごとけんです
[#9116] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— matz@... (Yukihiro Matsumoto)
2000/02/05
まつもと ゆきひろです
[#9119] Re: [REQ] Integer#{hex,dec,oct,bin}, String#bin
— gotoken@... (GOTO Kentaro)
2000/02/05
ごとけんです
[#8828] Re: [ruby-list:20054] Re: == === case — Shugo Maeda <shugo@...>
前田です。
11 messages
2000/01/05
[#8829] Re: [ruby-list:20054] Re: == === case
— matz@... (Yukihiro Matsumoto)
2000/01/05
まつもと ゆきひろです
[#8866] DoubleFloat — gotoken@... (GOTO Kentaro)
ごとけんです
13 messages
2000/01/07
[#8867] Re: DoubleFloat
— EGUCHI Osamu <eguchi@...>
2000/01/07
えぐち@エスアンドイー です。
[#8869] Re: DoubleFloat
— gotoken@... (GOTO Kentaro)
2000/01/07
In message "[ruby-dev:8867] Re: DoubleFloat"
[#8886] Complex#divmod — Masahiro TANAKA <masa@...>
田中@ISASです。ついでに気になっていることを。
11 messages
2000/01/08
[#8895] Re: Complex#divmod
— keiju@... (石塚圭樹)
2000/01/10
けいじゅ@日本ラショナルソフトウェアです.
[#8899] Re: Complex#divmod
— matz@... (Yukihiro Matsumoto)
2000/01/10
まつもと ゆきひろです
[#8893] Re: [ruby-list:20142] Re: Range expansion? — Akinori MUSHA aka knu <knu@...>
knuです。ruby-listから舞台を移しました。
13 messages
2000/01/09
[#8906] Re: [ruby-list:20142] Re: Range expansion?
— Shugo Maeda <shugo@...>
2000/01/11
前田です。
[#8924] Re: [ruby-list:20142] Re: Range expansion?
— matz@... (Yukihiro Matsumoto)
2000/01/13
まつもと ゆきひろです
[#8925] Re: [ruby-list:20142] Re: Range expansion?
— Shugo Maeda <shugo@...>
2000/01/13
前田です。
[#8926] Re: [ruby-list:20142] Re: Range expansion?
— matz@... (Yukihiro Matsumoto)
2000/01/13
まつもと ゆきひろです
[#8941] [BUG] recycle the ruby_dyna_vars — Koji Arai <JCA02266@...>
新井です。
9 messages
2000/01/16
[#8953] rb_str2inum() — "Shigeo Kobayashi" <shigeo@...>
小林です。
5 messages
2000/01/18
[#8980] 1.4.3 patch for near-future *BSD IPv6 support — Jun-ichiro itojun Hagino <itojun@...>
近い将来の{Net,Free,Open}BSDにはKAME IPv6 stackが統合されています。
17 messages
2000/01/20
[#8981] Re: 1.4.3 patch for near-future *BSD IPv6 support
— Jun-ichiro itojun Hagino <itojun@...>
2000/01/20
> それから、
[#8989] Re: 1.4.3 patch for near-future *BSD IPv6 support
— MIYAJIMA Mitsuharu <miya@...>
2000/01/21
[#8996] Re: 1.4.3 patch for near-future *BSD IPv6 support
— Jun-ichiro itojun Hagino <itojun@...>
2000/01/21
[#9049] Re: 1.4.3 patch for near-future *BSD IPv6 support
— Katsuyuki Komatsu <komatsu@...>
2000/02/01
小松です。
[#8986] sort — gotoken@... (GOTO Kentaro)
ごとけんです
13 messages
2000/01/20
[#9004] DEFAULT_KCODE in rbconfig.rb — OKUNISHI -GTO- Fujikazu <fuji0924@...>
OS/2 隠居の奥西@京田辺市です。
8 messages
2000/01/22
[#9005] Re: DEFAULT_KCODE in rbconfig.rb
— matz@... (Yukihiro Matsumoto)
2000/01/23
まつもと ゆきひろです
[#9008] [PATCH] Array#flatten! for recursive array — nobu.nakada@...
なかだです。
9 messages
2000/01/24
[#9011] Re: [PATCH] Array#flatten! for recursive array
— matz@... (Yukihiro Matsumoto)
2000/01/24
まつもと ゆきひろです
[#9024] Re: [ruby-math:00115] Re: precedence of ** — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
4 messages
2000/01/26
[#9048] [PATCH] OS/2 patch improved for 1.5.0 — kenn@...
長沢です。
6 messages
2000/01/31
[ruby-dev:9042] Ruby's overhead
From:
"Shigeo Kobayashi" <shigeo@...>
Date:
2000-01-29 15:20:41 UTC
List:
ruby-dev #9042
小林です。
なんとか、BigFloat が少し安定したので 1.0.0 に
して RAA に入れました。new その他の仕様を変
更しました(今までダウンロードされた方、影響は
ないですよね?)。詳しくは、中に bigfloat.html が
ありますので、そちらを参照してください。
で、以下のようにπを 4000 桁まで計算するプロ
グラムを Ruby で作ってみました。この時間と、
BigFloat::PI(4000) と比べてみました(pi.rb はまだ
試していません)。ロジックはどちらも全く同じです。
従って、時間差は Ruby のオーバーヘッドになる
と思います。
結果は AMD K6(266MHz) で BigFloat::PI(4000)
が 4.89 秒、Ruby が 9.48 秒でした。このような
計算は内部計算の比率が高いので、Ruby の
オーバーヘッド比率は少ないと思っていた私に
は、やや意外でした。反面、内部は整数計算だし、
こんなものかな?という気もします。急造試験な
ので、間違いを恐れるものではありますが、皆さ
んはどうとらえますか ?
なを、このπロジック(プログラム)は松阪大学の
奥村晴彦さんが以下のURLで公開している Java
の BigDecimal を使用したものと同じです。
http://www.matsusaka-u.ac.jp/~okumura/java/keisan-big.html
BigDecimal と BigFloat の扱いはかなり異なる
(と思われる)のに、 BigFloat::PI() はこれとほとん
ど同じスピードです。 (^。^)
require "BigFloat"
#
# PI (Calculates 3.1415.... using J. Machin's formula.
#
# 1. Calculate 'sig' figures using BigFloat::PI(sig).
# 2. Calculate the same 'sig' figures using Ruby's iteration
# with the same formula.
# 3. Compares time consumed.
#
sig = 4000 # <== Number of significant figures
exp = -sig
sig = sig + sig/100 # no theoretical reason
pi = BigFloat::new("0")
two = BigFloat::new("2")
m25 = BigFloat::new("-0.04")
m57121 = BigFloat::new("-57121")
k = BigFloat::new("1")
t = BigFloat::new("-80")
v = BigFloat::new("0",sig)
u = BigFloat::new("0",sig)
ts = Time::now
vpi = BigFloat::PI(sig) # 1. Step 1
tvp = Time::now - ts
# p vpi
n1 = 0
n2 = 0
ts = Time::now
while (true) # 2. Step 2
n1 += 1
# BigFloat::divmod!(v,t,m25)
BigFloat::mult!(v,t,m25)
t = v.dup
BigFloat::divmod!(u,t,k)
break if(u.exponent < exp )
BigFloat::add!(v,pi,u)
pi = v.dup
k = k + two
end
k = BigFloat::new("1")
t = BigFloat::new("956")
while (true)
n2 += 1
BigFloat::divmod!(v,t,m57121)
t = v.dup
BigFloat::divmod!(u,t,k)
break if(u.exponent < exp )
BigFloat::add!(v,pi,u)
pi = v.dup
k = k + two
end
tr = Time::now - ts
# p pi
print "# of iterations = ",n1,"+",n2,"\n"
print "Ext lib=",tvp,"\n" # Time spent by ext lib.
print "Ruby =",tr,"\n" # TIme spent by Ruby + ext. lib.
#
# tr-tvp should Ruby's overhead(the time spent by Ruby).
#
p pi - vpi
exit
小林 茂雄
E-Mail: shigeo@tinyforest.gr.jp
Home Page: http://www.tinyforest.gr.jp