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$$$%"%$%G%"!*e(B

e$B:#$^$G$Ne(B Complex e$B$O!“e(Bcomplex.rb e$B$K$[$;D$7$F!”$?$H$($Pe(B
Rational [email protected],e(B
e$B$NJ#AG?t$r;H$$$?$$?M$O!"e(BComplex
e$B$r;H$$!“2J3X5;=Q7W;;$r$7$?$$?M$O!”$3e(B
e$B$Ne(B (2) e$B$r;H$(!D!D$G!"H,J}4]$/<}$^$k$N$G$O$J$$$G$7$g$&$+!#e(B

(2) e$B$K$O?7$7$$L>A0$,I,MW$K$J$j$^$9$M!#2>$Ke(B ComplexFloat
e$B$H$9$k$H!"%/%ie(B
e$B%94X78$O!"$"$?$i$7$$e(B InexactNum(e$B2>>Ne(B)e$B$rF3F~$7$F!"e(B

Numeric - InexactNum - Float
- ComplexFloat

e$B$H$9$k$+!"e(BRealFloat(e$B2>>Ne(B)e$B$rF3F~$7$Fe(B

Numeric - Float - RealFloat
- ComplexFloat

e$B$H$9$k$+!#$$$:$l$K$7$F$bBg$-$JJQ99$K$J$k$1$I!#e(B

e$B$G!"e(BMath.sqrt(-8)
e$B$O!“e(BComplexFloat(e$B2>>Ne(B)e$B$rJV$;$P$h$$!”$H!#e(B

Math.sqrt e$B$,%G%U%)%k%H$G!"e(BInteger e$B$rJV$7$?$je(B Float
e$B$rJV$7$?$j$9$k$N$O!“e(B
e$BDq93$,$”$ke(B(mathn e$B$N2<$G$OJLe(B)e$B$N$G$9$,!"e(BFloat
e$B$rJV$7$?$je(B ComplexFloat(e$B2>e(B
e$B>Ne(B)e$B$rJV$7$?$j$9$k$N$O!"NI$$5$$,$7$^$9!#e(B

e$B$d$O$j%j%F%i%k$,M_$7$$!#e(B

e$BLdBj$O!VM-M}?te(B**e$BM-M}?t!W$+$J!#e(B

[email protected]$G$9!#e(B

At Fri, 28 Mar 2008 12:15:45 +0900,
Shin-ichiro HARA wrote in [ruby-dev:34161]:

Masahiro TANAKA e$B$5$s$O=q$-$^$7$?e(B:

(2) Ce$B$de(BFORTRANe$B$NJ#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$B$G$b8e<T$G<BAu$5$l$F$$$k$N$G!"e(B
e$B;EMM$r;29M$K$G$-$k!#e(B

python e$B$OM-M}?t$b$J$$$7!“B>$K$b;29M$K$J$k$b$N$O$”$k$N$G!#e(B

c. e$B3HD%%i%$%V%i%j$+$i%"%/%;%9$7$d$9$$!#e(B

e$B$J$I$,$"$j$^$9!#J#AG?t$O2J3X5;=Q7W;;$G$h$/;H$&7?$G!"e(B
e$B$=$&$$$&;H$$J}$+$i$9$l$Pe(B(2)e$B$NJ}$,5a$a$i$l$^$9!#e(B
e$B5U$K!"e(B(1)e$B$rAH$9~$[email protected]$,;W$$Ib$+$P$J$$$N$G$9$,!"e(B
(2)e$B$G$J$/e(B(1)e$B$rAH$9~$$K$9$kM}M3$H$O2?$G$7$g$&$+e(B?

e$B$=$l$ON;8+$,69$$$G$9$M!#e(B

[email protected]$C$?$i!"e(Bruby
e$B$OIbF0>[email protected][email protected]$1$K$9$l$P$$$$$s$8$c$J$$$G$9$+$M!#[email protected]!"e(B
ruby
e$B$N>l9g!"4{B8$N?tCM1i;;$b$=$s$J$KB.$/$J$$$H;W$&$N$G!“J#AG?t$N$”$D$+e(B
e$B$$$rJQ$($?$+$i$H$$$C$F!"2J3X5;=Q7W;;[email protected]$1LrN)$F$i$l$k$N$+CN$je(B
e$B$^$;$s$1$I!#e(B

e$B5U$K!"e(Brational
e$B$,AH$9~$$G!"J#AG?t$G$D$+$($J$/$9$kM}M3$O$J$s$G$9$+e(B?
Common Lispe$B!"e(BSchemee$B!"e(BFactore$B!“e(BSqueak
e$B$J$I$G$bIaDL$K$D$+$($^$9$,!”$3$N$"e(B
[email protected]$O$A$g$C$H$*$+$7$$$C$F$3$H$J$s$G$9$+$M!#e(B

e$B$b$7!“EDCf$5$s$N<gD%$,[email protected]$H$7$F$b!”$d$O$j!“e(BComplex
e$B$O!”$h$j0lHLe(B
e$BE*$J;EMM$G$"$k$Y$-$G!"EDCf$5$s$N$$$o$l$k$h$&$J$b$N$O!"e(BComplex
e$B$NFb$K$"e(B
e$B$k$K$;$h!“30$K$”$k$K$;$h!"FC<l$J$b$N$H$7$F07$o$l$k$Y$-$8$c$J$$$G$7$g$&e(B
e$B$+!#e(B

e$B:#2s$O!"$h$j$h$$<BAu$GCV$-49$($k!"$3$H$,L\[email protected]$C$?$3$H$b$"$j$^$9$,!"KMe(B
e$B$O!“C/$bB.$/$7$F$/$l$H$$$C$F$J$$$N$K!“B.$/$J$$$H%@%[email protected]!”;EMM$r6J$2$F$Ge(B
e$B$bB.$/$7$h$&!”$J$I$H$O9M$($b$7$^$;$s$G$7$?!#e(B

Shin-ichiro HARA e$B$5$s$O=q$-$^$7$?e(B:

e$B:#$^$G$Ne(B Complex e$B$O!“e(Bcomplex.rb e$B$K$[$;D$7$F!”$?$H$($Pe(B Rational [email protected],e(B
e$B$NJ#AG?t$r;H$$$?$$?M$O!"e(BComplex e$B$r;H$$!“2J3X5;=Q7W;;$r$7$?$$?M$O!”$3e(B
e$B$Ne(B (2) e$B$r;H$(!D!D$G!"H,J}4]$/<}$^$k$N$G$O$J$$$G$7$g$&$+!#e(B

e$B6&B8$G$-$k$H$h$$$3$H$G$9$,!";EMM$H$+$G$b$a$=$&$+$b!#e(B
e$B%/%i%94X78$H$+!“Aj8_$KJQ49$9$k5,B’$O$I$&$9$k$+!”$H$+!#e(B

e$B$H$9$k$+!#$$$:$l$K$7$F$bBg$-$JJQ99$K$J$k$1$I!#e(B

e$B%/%i%94X78$OFq$7$$$H$3$m$G$9!#Jq4^4X78$G$$$($P!"e(B

Numeric
|- Complex - ComplexFloat(e$B2>e(B)
|- Real - Float
|- Rational
|- Integer – Fixnum
|- Bignum

e$B$J$I$b9M$($i$l$^$9$,!"$3$l$H%/%i%94X78$H$OI,$:$7$bF1$8OC$G$O$J$$$+$be(B
e$B$7$l$^$;$s!#e(B

e$B$G!"e(BMath.sqrt(-8) e$B$O!“e(BComplexFloat(e$B2>>Ne(B)e$B$rJV$;$P$h$$!”$H!#e(B

Math.sqrt e$B$,%G%U%)%k%H$G!"e(BInteger e$B$rJV$7$?$je(B Float e$B$rJV$7$?$j$9$k$N$O!“e(B
e$BDq93$,$”$ke(B(mathn e$B$N2<$G$OJLe(B)e$B$N$G$9$,!"e(BFloat e$B$rJV$7$?$je(B ComplexFloat(e$B2>e(B
e$B>Ne(B)e$B$rJV$7$?$j$9$k$N$O!"NI$$5$$,$7$^$9!#e(B

e$BF10U$G$9$,!"e(BPythone$B$,e(Bcmathe$B$KJ,$1$F$$$kM}M3$G!"e(B

http://www.python.jp/doc/current/lib/module-cmath.html e$B$h$je(B:

e$B5!G=$rFs$D$N%b%8%e!<%k$KJ,$1$F$$$k$N$O!“J#AG?t$K6=L#$,$J$+$C$?$j!”$b$7e(B
e$B$+$9$k$HJ#AG?t$H$O2?$+$9$iCN$i$J$$$h$&$J%f!<%6$,$$$k$+$i$G$9!#$=$&$$$Ce(B
e$B$??M$?$A$O$`$7$m!"e(Bmath.sqrt(-1) e$B$,J#AG?t$rJV$9$h$j$bNc30$rAw=P$7$F$[$7e(B
e$B$$$H9M$($^$9!#e(B

e$B$H$$$&$N$b0lM}$"$k$J$"$H!#e(B

e$BEDCf>;9(e(B

Nobuyoshi N. e$B$5$s$O=q$-$^$7$?e(B:

Shin-ichiro HARA wrote in [ruby-dev:34161]:

Masahiro TANAKA e$B$5$s$O=q$-$^$7$?e(B:

(2) Ce$B$de(BFORTRANe$B$NJ#AG?t7?$r%i%C%W$7$?!"<BIt!&5uIt$,e(Bdoublee$B7?$NJ#AG?t%/%i%9e(B

e$B>/$J$/$H$be(BC90e$B$K$OJ#AG?t7?$O$J$$$H;W$$$^$9$,!D!#e(B

e$B$3$l$O!“e(BC99e$B$NJ#AG?t7?!”$"$k$$$O$=$l0JA0$G$be(B

typedef struct {
double real;
double imag;
} complex;

e$B$J$I$H9=B$BN$GJ#AG?t7?$rDj5A$9$k$3$H$O0lHLE*$K$*$3$J$o$l$F$$$k$N$G!"e(B
e$B$=$N%G!<%?7?$r;X$7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$7!“B>$K$b;29M$K$J$k$b$N$O$”$k$N$G!#e(B

e$B;29M$K$J$k$b$N$H$Oe(B? e$B$H;W$C$?$i2<$K=q$$$F$"$j$^$9$M!#e(B

c. e$B3HD%%i%$%V%i%j$+$i%"%/%;%9$7$d$9$$!#e(B

e$B$J$I$,$"$j$^$9!#J#AG?t$O2J3X5;=Q7W;;$G$h$/;H$&7?$G!"e(B
e$B$=$&$$$&;H$$J}$+$i$9$l$Pe(B(2)e$B$NJ}$,5a$a$i$l$^$9!#e(B
e$B5U$K!"e(B(1)e$B$rAH$9~$[email protected]$,;W$$Ib$+$P$J$$$N$G$9$,!"e(B
(2)e$B$G$J$/e(B(1)e$B$rAH$9~$$K$9$kM}M3$H$O2?$G$7$g$&$+e(B?

e$B$=$l$ON;8+$,69$$$G$9$M!#e(B

e$B$=$l$O=E!9>5CN$7$F$$$k$s$G$9$,!"e(B
e$B$=$l$>$l$NN;8+$G;[email protected]$o$J$$$H?JJb$7$J$$$H;W$&$N$G!#e(B

[email protected]$C$?$i!"e(Bruby e$B$OIbF0>[email protected][email protected]$1$K$9$l$P$$$$$s$8$c$J$$$G$9$+$M!#[email protected]!"e(B
ruby e$B$N>l9g!"4{B8$N?tCM1i;;$b$=$s$J$KB.$/$J$$$H;W$&$N$G!“J#AG?t$N$”$D$+e(B
e$B$$$rJQ$($?$+$i$H$$$C$F!"2J3X5;=Q7W;;[email protected]$1LrN)$F$i$l$k$N$+CN$je(B
e$B$^$;$s$1$I!#e(B

e$B<B:]$Ke(BRubye$B$r?tCM7W;;$K;H$C$F$$$kNc$H$7$Fe(B
http://www.artcompsci.org/ e$B$J$I$,$"$j$^$9!#e(B
Rubye$B$b$=$l$J$j$K?tCM7W;;$KLr$KN)$D$s$G$9!#e(B
[email protected]$5$s$,e(BFloate$B$rB.$/$7$h$&$H$7$F$$$^$9$,!"e(B
e$B$=$&$J$l$P$3$&$$$&;H$$J}$K$OLr$KN)$A$^$9!#e(B
e$B$3$&$$$&N.$l$+$i!"J#AG?t$rB.$/$7$?$$$H$$$&MWK>$Oe(B
e$BA}$($k$H;W$$$^$9!#e(B

[email protected]!"e(BRubye$B$K$O!“6&[email protected]$,$”$j!"e(B
e$B<B:]e(BFloate$B$He(BRationale$B$O:#$G$b6&B8$G$-$F$$$k$o$1$G!"e(B
e$B$3$l$O$+$J$jL%NOE*[email protected][email protected]$H;W$$$^$9!#e(B

e$B5U$K!"e(Brational e$B$,AH$9~$$G!"J#AG?t$G$D$+$($J$/$9$kM}M3$O$J$s$G$9$+e(B?

e$B8=>u$Ne(B Complex e$B$r;H$($J$/$7$h$&!"$H$$$&Ds0F$G$O$J$/!“e(B
e$B86$5$s$N%a!<%k$K$b$”$k$h$&$K!"6&B8$9$k$3$H$b$G$-$k$H;W$$$^$9!#e(B

Common Lispe$B!"e(BSchemee$B!"e(BFactore$B!“e(BSqueak e$B$J$I$G$bIaDL$K$D$+$($^$9$,!”$3$N$"e(B
[email protected]$O$A$g$C$H$*$+$7$$$C$F$3$H$J$s$G$9$+$M!#e(B

e$B$3$&[email protected]$,2J3X5;=Q7W;;$G%P%j%P%j$K;H$o$l$F$$$k$H$$$&OC$Oe(B
e$BJ9$$$?$3$H$,$"$j$^$;$s!#e(B
e$B$=$&$$$&<BAu$G$O!"2J3X5;=Q7W;;$K$O8~$+$J$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B$b$7!“EDCf$5$s$N<gD%$,[email protected]$H$7$F$b!”$d$O$j!“e(BComplex e$B$O!”$h$j0lHLe(B
e$BE*$J;EMM$G$"$k$Y$-$G!"EDCf$5$s$N$$$o$l$k$h$&$J$b$N$O!"e(BComplex e$B$NFb$K$"e(B
e$B$k$K$;$h!“30$K$”$k$K$;$h!"FC<l$J$b$N$H$7$F07$o$l$k$Y$-$8$c$J$$$G$7$g$&e(B
e$B$+!#e(B

e$B$=$&$+$b$7$l$^$;$s!#$3$3$O5D[email protected]$N$7$I$3$m$G$O$J$$$G$7$g$&$+!#e(B

e$B:#2s$O!"$h$j$h$$<BAu$GCV$-49$($k!"$3$H$,L\[email protected]$C$?$3$H$b$"$j$^$9$,!"KMe(B
e$B$O!“C/$bB.$/$7$F$/$l$H$$$C$F$J$$$N$K!“B.$/$J$$$H%@%[email protected]!”;EMM$r6J$2$F$Ge(B
e$B$bB.$/$7$h$&!”$J$I$H$O9M$($b$7$^$;$s$G$7$?!#e(B

e$BCf$K$OB.$/$J$$$H%@%[email protected]!"$H$$$&;H$$J}$r$9$k>l9g$b$"$j!"e(B
e$B$=$&$$$&;H$$J}$b$G$-$k$h$&$J;EMM$K$J$l$P$h$$$H;W$&$N$G$9!#e(B

[email protected]!"$b$7$+$7$F!“AH$_9~$_J#AG?t$,!“B.$$J#[email protected]$rH]Dj$9$k$h$&$Je(B
e$B<BAu$X8~$+$C$F$$$k$h$&$K8+$($?$N$G!”$3$&$$$&MWK>$b$”$k$H$$$&$3$H$rEA$(e(B
e$B$?$+$C$?$N$G$7$?!#e(B

e$BEDCf>;9(e(B

e$B:[email protected]$C$F$*$-$^$9$,!"5$$r0-$/$5$l$?$N$J$i$9$_$^$;$s!#e(B
e$B7h$7$F$U$J$P$5$s$,$5$l$F$$$k$3$H$rH]Dj$7$F$$$k$o$1$G$O$J$/!"e(B
[email protected]!“AH$9~$$N7P0^$,8+$($J$$$N$G!”<ALd$7$?$N$G$9!#e(B

e$B5$$K$7$J$$$G$/[email protected]$5$$!#e(B

e$B2>$K$=$&[email protected]$H$7$F$b!"e(Brational e$B$N07$$$rD>$A$K<N$F$kI,MW$b$J$$$H;W$C$F$$$^e(B
e$B$9!#e(B

e$B$=$&$$$&0U?^$O$J$+$C$?$N$G$9$,!"@eB-$i$:$G$7$?$M!#e(B

e$B:#FI$_JV$7$F$b$=$N$h$&$K$7$+2r<a$G$-$J$$$G$9$,!“KM<+?H$O!“B.EY2~A1$NM>e(B
e$BCO$O$”$k$H;W$C$F$$$^$9$,!“EDCf$5$s$+$i$O!”$=$NM>CO$,$J$/!“4V0c$C$?H=CGe(B
e$B$r$7$?!”$”$k$$$O$7$D$D$"$k!"[email protected]$o$l$?$h$&$K;W$$$^$9!#e(B

Common Lispe$B!"e(BSchemee$B!"e(BFactore$B!“e(BSqueak e$B$J$I$G$bIaDL$K$D$+$($^$9$,!”$3$N$"e(B
[email protected]$O$A$g$C$H$*$+$7$$$C$F$3$H$J$s$G$9$+$M!#e(B

e$B$3$&[email protected]$,2J3X5;=Q7W;;$G%P%j%P%j$K;H$o$l$F$$$k$H$$$&OC$Oe(B
e$BJ9$$$?$3$H$,$"$j$^$;$s!#e(B
e$B$=$&$$$&<BAu$G$O!"2J3X5;=Q7W;;$K$O8~$+$J$$$s$8$c$J$$$G$7$g$&$+!#e(B

ruby e$B$O$$$D:"$+$i2J3X5;=Q7W;;[email protected]$K$J$C$?$s$G$9$+$M!#e(B

e$B:#2s$O!"$h$j$h$$<BAu$GCV$-49$($k!"$3$H$,L\[email protected]$C$?$3$H$b$"$j$^$9$,!"KMe(B
e$B$O!“C/$bB.$/$7$F$/$l$H$$$C$F$J$$$N$K!“B.$/$J$$$H%@%[email protected]!”;EMM$r6J$2$F$Ge(B
e$B$bB.$/$7$h$&!”$J$I$H$O9M$($b$7$^$;$s$G$7$?!#e(B

e$BCf$K$OB.$/$J$$$H%@%[email protected]!"$H$$$&;H$$J}$r$9$k>l9g$b$"$j!"e(B
e$B$=$&$$$&;H$$J}$b$G$-$k$h$&$J;EMM$K$J$l$P$h$$$H;W$&$N$G$9!#e(B

e$B$=$l$rH]Dj$9$k?M$OC/$b$$$J$$$G$7$g$&!#2DG=$J$i$P!#e(B

[email protected]!"$b$7$+$7$F!“AH$_9~$_J#AG?t$,!“B.$$J#[email protected]$rH]Dj$9$k$h$&$Je(B
e$B<BAu$X8~$+$C$F$$$k$h$&$K8+$($?$N$G!”$3$&$$$&MWK>$b$”$k$H$$$&$3$H$rEA$(e(B
e$B$?$+$C$?$N$G$7$?!#e(B

e$B$I$N$"$?$j$G$7$g$&$+!#e(B

Funabae$B$5$s$O=q$-$^$7$?e(B:

e$B2>$K$=$&[email protected]$H$7$F$b!“e(Brational e$B$N07$$$rD>$A$K<N$F$kI,MW$b$J$$$H;W$C$F$$$^e(B
e$B$9!#e(B
e$B$=$&$$$&0U?^$O$J$+$C$?$N$G$9$,!”@eB-$i$:$G$7$?$M!#e(B
e$B:#FI$_JV$7$F$b$=$N$h$&$K$7$+2r<a$G$-$J$$$G$9$,!"e(B

e$B<N$F$:$K!"6&B8$G$-$k$+$b$7$l$J$$$H$$$&$3$H$O!“e(B
e$B:G=i$N%a!<%k$K$O=q$$$F$”$j$^$;$s$G$7$?!#e(B

e$BKM<+?H$O!“B.EY2~A1$NM>e(B
e$BCO$O$”$k$H;W$C$F$$$^$9$,!“EDCf$5$s$+$i$O!”$=$NM>CO$,$J$/!"e(B

e$B;d$N9M$($G$O!“e(Bdoublee$B$G<BAu$9$k$N$KHf$Y$l$PB.EY$NLL$GB=?’$,$”$k$He(B
e$B;W$C$F$$$^$9!#e(B

e$B4V0c$C$?H=CGe(B
e$B$r$7$?!"$"$k$$$O$7$D$D$"$k!"[email protected]$o$l$?$h$&$K;W$$$^$9!#e(B

e$B;d$N9M$($H$O0c$&!"$H$$$($P$=$&$G$9!#e(B
e$B$=$l$,4V0c$$$+$I$&$+$O$o$+$j$^$;$s$,!#e(B

ruby e$B$O$$$D:"$+$i2J3X5;=Q7W;;[email protected]$K$J$C$?$s$G$9$+$M!#e(B

e$B2J3X5;=Q7W;;[email protected](Be$B$K$be(Be$B1~MQ$7$h$&$H$$$&$9$kF0$-$O!“e(B
e$B;d$,CN$k8B$je(B1999e$BG/$/$i$$$+$i$G$9$M!#e(B
Rubye$B$r2J3X5;=Q7W;;[email protected]$K$9$k!”$H$$$&OC$G$O$"$j$^$;$s$,!#e(B

e$BEDCf>;9(e(B

e$B:XF#$H?=$7$^$9!#1T$$$+$OJ,$+$j$^$;$s$,!"[email protected]$1C;$a$KJL3QEY$N%D%C%3%_$r!#e(B

On Fri, 28 Mar 2008 01:52:09 +0900
Masahiro TANAKA [email protected] wrote:

(2) Ce$B$de(BFORTRANe$B$NJ#AG?t7?$r%i%C%W$7$?!"<BIt!&5uIt$,e(Bdoublee$B7?$NJ#AG?t%/%i%9e(B

e$B>e5-0F$O!“[email protected][email protected]$G$O1-F]$_$K$9$k$N$OFq$7$=$&$G$9$,!”[email protected]$G$be(B
e$B$"$^$j$&$l$7$/$J$$$+$b$7$l$^$;$s!#$H$$$&$N$b!"$=$3$^$G$7$J$/$F$be(B

a. e$BB.EY$G3JCJ$KM-Mx!#e(B

[email protected]$k$+$i$G$9!#e(B(sizeof(VALUE)8 ==
64bite$B%^%7%s8BDj$G$9$,e(B) e$B:{ED$5$s$,e(B
e$B0JA0$+$i$
$C$7$c$C$F$$$F!"@hF|H/I=$J$5$C$?!Ve(BFloate$BKd$a9~$_!W$,%^!<%8$5$l$l$Pe(B
e$B!V2?$b$7$J$/$F$b!W8=>u$Ne(BComplexe$B$N$^$^$G9bB.$K$J$k$H;W$$$^$9!#e(B

Complexe$B%$%s%9%?%s%9K\BN$Oe(B include/ruby/ruby.h e$B$Ge(B

struct RComplex {
struct RBasic basic;
VALUE real;
VALUE image;
};

[email protected]@$5$l$F$$$^$9$,!":{ED$5$s$NJ}K!$G$9$H4{B8$Ne(BRubye$B%9%/%j%W%H$N$_$J$i$:!“e(B
API (DOUBLE2NUM()/RFLOAT_VALUE()) e$B$rMxMQ$7$Fe(BFloat(==
double)e$B$rMxMQ$7$F$$$ke(B
Ce$B%W%m%0%i%`$b$9$Y$F!”$=$N9bB.2=$N287C$K$"$:$+$l$k$+$i$G$9e(B
(e$B$h$Me(B?)e$B!#e(B

e$B>e5-e(BFloate$B9bB.2=$N%^!<%80JA0$K$b!"e(BComplex/Rationale$B$rFC2=L?Na$rBP1~$5$;$Fe(B

e$B9bB.2=$r4|BT$9$kJ}K!$b$"$j$^$9!#$h$M!De(B

e$B$b$&0l$D!"e(B

c. e$B3HD%%i%$%V%i%j$+$i%"%/%;%9$7$d$9$$!#e(B

e$B$H$$$&$N$Oe(B
double d = RCOMPLEX(val)->real;
e$B$H=q$1$ke(B(e$B$+$b$7$l$J$$e(B)e$B$+$i!"$H$$$&$3$H$H2r<a$7$F$h$m$7$$$N$G$7$g$&$+!#e(B

e$B$b$7>e5-$K$D$$$F$J$i$P!"%^%/%m$rDj5A$7$Fe(B
dobule d = RCOMPLEX_REAL(val);
e$B$H$9$l$P!"<+J,$O==J,$K%"%/%;%9$7$d$9$/46$8$^$9$7!"%?%$%W?t$O5U$K8:$j$^$9!#e(B

e$B$^$?e(B1.8e$B$HHf$Y$F!“e(B1.9e$B$G$Oe(BRFOO(obj)e$B$G%-%c%9%H$9$k%^%/%m$rMQ$$$FD>@\9=B$BN$Ne(B
e$B%a%s%P$rFI$_<h$k$N$O!“Hs?d>)[email protected][email protected]$H;W$$$^$9!#$;$C$+$/e(B
e$BE}0lE*$J%$%s%?%U%’!<%9$,[email protected]$K:n$i$l$h$&$H$7$F$$$k;~$K!Ve(BRFOO(obj)->membere$B!W$,e(B
e$BI,MW$J$i$P!”!VNc30E*$K07$&I,MW$,$”$k!W$H$$$&0UL#$G%"%/%;%9$7$K$/$/46$8$^$9!#e(B

e$B$h$C$Fe(B c
e$B$K$O$"$^[email protected]@NO$,$J$$$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B
(e$B<+J,$N2r<a$,4V0c$C$F$$$k$J$i!"$=$l$,$^$:0-$$$N$G8f;XE&[email protected]$1$k$H$"$j$,$?$$e(B
e$B$G$9e(B ^^;)

e$B;d$N9M$($G$O!“e(Bdoublee$B$G<BAu$9$k$N$KHf$Y$l$PB.EY$NLL$GB=?’$,$”$k$He(B
e$B;W$C$F$$$^$9!#e(B

e$B>o$K$J$K$+$7$i$NLL$GB=?’$,$"$C$FEvA3$8$c$J$$$G$9$+!#$7$+$b!"6qBNE*$K:$$Ce(B
e$B$F$$$k;vNc$d%G!<%?$b$J$/!“8=;[email protected]$G$O;[email protected]$1!”$G$9$7!#e(B

ruby
e$B$bIbF0>[email protected]?t$KFC2=$7$?<BAu!“J8;zNs=hM}$rBgI}$K=L>.$7$?<BAu!”$$$me(B
e$B$$$mFC<l2=$9$l$P!“B.$/$J$k$G$7$g$&!#$=$l$O$=$l$G0UL#$,$”$k$H;W$$$^$9$,!"e(B
e$B$=$&$$$&$N$rL;X$7$F$J$$$N$G!#e(B

ruby e$B$O$$$D:"$+$i2J3X5;=Q7W;;[email protected]$K$J$C$?$s$G$9$+$M!#e(B

e$B2J3X5;=Q7W;;[email protected](Be$B$K$be(Be$B1~MQ$7$h$&$H$$$&$9$kF0$-$O!“e(B
e$B;d$,CN$k8B$je(B1999e$BG/$/$i$$$+$i$G$9$M!#e(B
Rubye$B$r2J3X5;=Q7W;;[email protected]$K$9$k!”$H$$$&OC$G$O$"$j$^$;$s$,!#e(B

[email protected]$H$7$F$O!“e(Bruby e$B$h$j$be(B Common Lisp
e$B$”$?$j$N$[$&$,!"$`$7$m8~$$$F$$$ke(B
e$B$h$&$J5$$,$7$^$9$,!"7k6I!"26$N9M$($ke(B ruby
e$B$8$c$J$$!“26$N9M$($F$?e(B
Complex e$B$8$c$J$$!”[email protected][email protected]$1$K;W$($^$9!#e(B

e$BB<ED$G$9!%e(B

2008/3/28 Tadayoshi F. [email protected]:

Common Lispe$B!"e(BSchemee$B!"e(BFactore$B!“e(BSqueak e$B$J$I$G$bIaDL$K$D$+$($^$9$,!”$3$N$"e(B
[email protected]$O$A$g$C$H$*$+$7$$$C$F$3$H$J$s$G$9$+$M!#e(B

e$B$3$&[email protected]$,2J3X5;=Q7W;;$G%P%j%P%j$K;H$o$l$F$$$k$H$$$&OC$Oe(B
e$BJ9$$$?$3$H$,$"$j$^$;$s!#e(B
e$B$=$&$$$&<BAu$G$O!"2J3X5;=Q7W;;$K$O8~$+$J$$$s$8$c$J$$$G$7$g$&$+!#e(B

ruby e$B$O$$$D:"$+$i2J3X5;=Q7W;;[email protected]$K$J$C$?$s$G$9$+$M!#e(B

Ruby
e$B$r2J3X5;=Q7W;;$K;H$&$?$a$K:GE,2=$9$k;v$rNI$$$H46$8$F$i$C$7$c$i$J$$$s$G$7$g$&$+!%e(B
e$B;d$Oe(B Ruby
[email protected]$i2J3X5;=Q7W;;$N%U%m%s%H%(%s%I$H$7$F;HMQ$7$F$$$^$7$F!$?tCM7W;;5!G=$,e(B
e$B$b$C$H$b$C$H9bB.2=$7$F$/$l$?$i4r$7$$$HF|!946$8$F$$$^$9!%e(B

e$B:#2s!$J#AG?t%i%$%V%i%j$NAH9~$_2=$H$$$&J8L.$G$3$N$h$&[email protected]$K$J$C$F$$$k$o$1$G$9$,!$e(B
Ruby e$B$NJ#AG?t%i%$%V%i%j$,?tCM7W;;0J30$NL\E*$G;HMQ$5$l$k$H$7$?$i!$e(B
e$B$I$s$JMQES$,B?$$$s$G$7$g$&$M!%;d$O?tCM7W;;0J30$NL\E*$G;HMQ$7$?$3$H$,L5$$$N$G!$e(B
e$BJ#[email protected],$rIbF0>[email protected]?t0J30$K$7$?$$$H;W$C$?$3$H$,$"$j$^$;$s!%e(B

[email protected]>/$79M$($k$HJ,Ln$d>l9g$K$h$C$F$Oe(BBigFloat
e$B$d8GDj>[email protected]?t$K$7$?$$;v$b$"$j$=$&$G$9$M!%e(B
e$B$=$&$$$&>l9g$O!$0B0W$Ke(B C99 e$B$Ne(B complex
e$B$K$7$F$7$^$&$N$O4r$7$/$J$$5$$,$7$^$9!%e(B
C++ e$B$Ne(B std::complex
e$B$N$h$&[email protected],$N7?$rA*Br$G$-$k$h$&$K$7$F!$NI$/;[email protected],$KBP$7$Fe(B
e$BFC<l<BAu$rMQ0U$9$k$3$H$GBP1~$G$-$J$$$G$7$g$&$+$M!%$=$N>l9g!$Aj8_$N7?JQ49$Ne(B
e$B%k!<%k$r7h$a$k$N$,BgJQ$G$7$g$&$+!%e(BMath.sqrt
e$B$N7k2L$r$I$&$9$k$+$H$$$&LdBj$be(B
e$BH/@8$7$F$7$^$$$^$9$M!%Fq$7$$e(B >_<

Tadashi S.e$B$5$s$O=q$-$^$7$?e(B:

e$B:XF#$H?=$7$^$9!#1T$$$+$OJ,$+$j$^$;$s$,!"[email protected]$1C;$a$KJL3QEY$N%D%C%3%_$r!#e(B

e$B9M$([email protected]$r$4Ds<([email protected]$-!";29M$K$J$j$^$9!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B

Ce$B%W%m%0%i%`$b$9$Y$F!"$=$N9bB.2=$N287C$K$"$:$+$l$k$+$i$G$9e(B (e$B$h$Me(B?)e$B!#e(B
e$B$J$k$[$I!#[email protected]$H%/%i%9%A%’%C%/$,M>J,$K$+$+$k$/$i$$$Ge(Bdoublee$B$r<h$j=P$;e(B
e$B$^$9$M!#[email protected]!“1i;;$r$*$3$J$&>l9g$O!”$5$i$Ke(Breale$B$N%a%=%C%I$r8F$V$N$G!"e(B
e$B$=$N%3%9%H$,5$$K$J$j$^$7$?!#e(B

e$B$H$9$l$P!"<+J,$O==J,$K%"%/%;%9$7$d$9$/46$8$^$9$7!"%?%$%W?t$O5U$K8:$j$^$9!#e(B
complex c = RCOMPLEX_VALUE(val);

e$B$H$G$-$F!"!J$G$-$k$s$G$7$g$&$M!K$7$+$b%a%b%j!<%3%T!<$G$9$`$H$h$$!"e(B
e$B$H;W$C$?$N$G$7$?!#e(B

e$B$^$?e(B1.8e$B$HHf$Y$F!“e(B1.9e$B$G$Oe(BRFOO(obj)e$B$G%-%c%9%H$9$k%^%/%m$rMQ$$$FD>@\9=B$BN$Ne(B
e$B%a%s%P$rFI$_<h$k$N$O!“Hs?d>)[email protected][email protected]$H;W$$$^$9!#$;$C$+$/e(B
e$BE}0lE*$J%$%s%?%U%’!<%9$,[email protected]$K:n$i$l$h$&$H$7$F$$$k;~$K!Ve(BRFOO(obj)->membere$B!W$,e(B
e$BI,MW$J$i$P!”!VNc30E*$K07$&I,MW$,$”$k!W$H$$$&0UL#$G%"%/%;%9$7$K$/$/46$8$^$9!#e(B

e$B$h$C$Fe(B c e$B$K$O$"$^[email protected]@NO$,$J$$$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B
(e$B<+J,$N2r<a$,4V0c$C$F$$$k$J$i!"$=$l$,$^$:0-$$$N$G8f;XE&[email protected]$1$k$H$"$j$,$?$$e(B
e$B$G$9e(B ^^;)

e$B$3$&$$$&>pJs$O!“9M$($?$jG<[email protected]$7$?$j$9$k>e$G=EMW$@$H;W$$$^$9!#e(B
e$B$”$j$,$H$&$4$6$$$^$9!#e(B

e$BEDCf>;9(e(B

Ruby e$B$r2J3X5;=Q7W;;$K;H$&$?$a$K:GE,2=$9$k;v$rNI$$$H46$8$F$i$C$7$c$i$J$$$s$G$7$g$&$+!%e(B

e$BNI$/$J$$$H$$$&$+!"L5M}$H$$$&$+!#8=;[email protected]$G!“e(Bruby
[email protected]$1$N$3$He(B
e$B$r$7$F$b!”$=$s$J$KBg$-$J7k2L$,[email protected]$i$l$k$H$O4|BT$G$-$J$$$H;W$$$^$9!#e(B

e$B;EMM>eB.EY8~>e$KITMx$J$H$3$m$,$"$k$H;W$&$7!“e(Bruby
e$B$N?tCM7O$O!”;EMM<BAue(B
e$BN>LL$G$NITHw$b>/$/$J$$$G$9!#G0$N0Y$KCG$C$F$*$-$^$9$,!“AH$9~$$NJ#AG?te(B
e$B$N$”$D$+$$$,!"2J3X5;=Q7W;;[email protected](B ruby
e$B$N80$r0.$C$F$$$k$o$1$G$OA4A3$J$$$He(B
e$B;W$$$^$9!#e(B

e$B:#8e!"COJ?$r9-$2$k$h$&$K!"EXNO$O$5$l$k$G$7$g$&$,!"2J3X5;=Q7W;;$N;3D:$re(B
e$BL;X$9$3$H$O9M$($K$/$$$H;W$$$^$9!#e(B

e$B;d$Oe(B Ruby [email protected]$i2J3X5;=Q7W;;$N%U%m%s%H%(%s%I$H$7$F;HMQ$7$F$$$^$7$F!$?tCM7W;;5!G=$,e(B
e$B$b$C$H$b$C$H9bB.2=$7$F$/$l$?$i4r$7$$$HF|!946$8$F$$$^$9!%e(B

e$B2J3X5;=Q7W;;0lHL$KITMx$G$b!“MxMQ$G$-$kHO0O$O$”$k$7!"$I$s$J$K8~$$$F$J$/e(B
e$B$F$b!"$D$+$*$&$H$9$k?M$O$$$k$H;W$$$^$9!#$=$l$O$=$l$GLLGr$$$H;W$$$^$9!#e(B

e$B:#2s!$J#AG?t%i%$%V%i%j$NAH9~$_2=$H$$$&J8L.$G$3$N$h$&[email protected]$K$J$C$F$$$k$o$1$G$9$,!$e(B
Ruby e$B$NJ#AG?t%i%$%V%i%j$,?tCM7W;;0J30$NL\E*$G;HMQ$5$l$k$H$7$?$i!$e(B
e$B$I$s$JMQES$,B?$$$s$G$7$g$&$M!%;d$O?tCM7W;;0J30$NL\E*$G;HMQ$7$?$3$H$,L5$$$N$G!$e(B
e$BJ#[email protected],$rIbF0>[email protected]?t0J30$K$7$?$$$H;W$C$?$3$H$,$"$j$^$;$s!%e(B

e$B$I$&$$$&MQES$,B?$$$+$OCN$j$^$;$s$,!“e(Bruby
e$BA4BN$G9M$($l$P!”$$$o$f$k?tCMe(B
e$B7W;;0J30$G$D$+$C$F$$$k?M$N$[$&$,05E]E*$8$c$J$$$G$9$+!#e(B

ruby
e$B$OJ8;zNs=hM}$J$I$N$[$&$,8~$$$F$$$k$H;W$$$^$9!#$=$l$G$b!"?tCM1i;;e(B
[email protected]$OGS=|$5$l$F$$$^$;$s!#e(B

rails e$B$r$D$+$&?M$K$H$C$F$O!“e(Bruby e$B$Oe(B rails
[email protected]$+$b$7$l$^$;$s!#$=$&$$$&e(B
e$B?M$K$O!“J#AG?t<+BN$,$”$^$jI,MW$G$O$”$j$^$;$s!#:n<T$N$^$D$b$H$5$s$b4^$a!“e(B
e$B05E]E*B??t$O!”$3$N7o$K6=L#$,$"$j$^$;$s!#e(B

ruby
e$B$,$"[email protected][email protected]$i$l$?$N$K!"<+J,$NETe(B
[email protected]$1<h$j=P$7$F!“B>$OMW$i$J$$!”$H$$$&[email protected]@NO$,$J$$$H;We(B
e$B$$$^$9!#e(B

e$BFC<l<BAu$rMQ0U$9$k$3$H$GBP1~$G$-$J$$$G$7$g$&$+$M!%$=$N>l9g!$Aj8_$N7?JQ49$Ne(B
e$B%k!<%k$r7h$a$k$N$,BgJQ$G$7$g$&$+!%e(BMath.sqrt e$B$N7k2L$r$I$&$9$k$+$H$$$&LdBj$be(B
e$BH/@8$7$F$7$^$$$^$9$M!%Fq$7$$e(B >_<

e$B$=$&$$$&$N$O!"$^$:$OJLES%i%$%V%i%j$G$d$k$N$,!"IaDL$8$c$J$$$G$7$g$&$+!#e(B
[email protected]$,>e$C$F!"MxMQ<T$,B?$1$l$P!“3HD%%i%$%V%i%j$dAH$9~$$H$$$&$3$H$b$“e(B
e$B$k$+$b$7$l$^$;$s!#$”$k$$$O!”$=$&$$$&5!G=$KFC2=$7$?e(B ruby
e$B$r$D$/$k$H$+!#e(B

e$B:#2s$N:n6H$KEv$C$F!"e(Bcomplex e$B$,:[email protected]$5$l$?$H$-$NOC$de(B Presition
[email protected];~$Ne(B
[email protected]$rFI$JV$7$^$7$?$,!"$3$3$^$GMh$k$N$K!“e(B10e$BG/$+$+$j$^$7$?!#:#2s!”;EMMe(B
e$BJQ99$7$J$+$C$?!"$H$$$&$N$GE$C$F$k?M$,$$$^$9$,!"$=$&$7$?$i!"AH$9~$<+e(B
e$BBN$,Fq$7$+$C$?$H;W$$$^$9e(B
(e$B$A$J$
$K!“K\7h$^$j$G$O$J$$e(B)e$B!#0lJb?J$a$?$3$He(B
e$B$K0U5A$,$”$k$H;W$$$^$9!#e(B

e$B$I$&$$$&MQES$,B?$$$+$OCN$j$^$;$s$,!“e(Bruby e$BA4BN$G9M$($l$P!”$$$o$f$k?tCMe(B
e$B7W;;0J30$G$D$+$C$F$$$k?M$N$[$&$,05E]E*$8$c$J$$$G$9$+!#e(B

Ruby e$B$NMQES$G$O$J$/J#AG?t%i%$%V%i%je(B (Complex e$B%/%i%9e(B) e$B$NMQES$,CN$j$?$+$C$?$G$9$h$M!%e(B
e$B$=$7$F!$e(BRuby e$B$N<g$JMQES$,?tCM7W;;$G$J$$$3$H$/$i$$$OCN$C$F$k$N$G8f0B?42<$5$$e(B ^^;

e$BD4::$7$?$3$H$b$J$$$N$G!"$=$l$OCN$j$^$;$s!#e(B

e$B$3$l$He(B Complex e$B$O$I$&4X78$"$k$s$G$9$+$M!)e(B
Complex e$B$N<BAu$,?tCM7W;;8~$1$N3HD%%b%8%e!<%k$r:n$j0W$$;EMM$KJQ99$5$l$k$H!$e(B
Rails e$B$,:$$C$?$j$9$k$s$G$9$+!);d$O$7$J$$$H;W$$$^$9$h!%e(B

e$B:$$i$J$$$H;W$$$^$9!#e(B

e$B3HD%%b%8%e!<%k$r:n$j0W$$;EMM1>!9$O=i$a$FJ9$$$?$h$&$K;W$$$^$9$,!#e(B

e$B2J3X5;=Q7W;;$K:GE,2=$G$-$J$$M}[email protected]@$7$F$$$^$9!#L[$C$F$$$F:GE,2=$5$le(B
e$B$k$o$1$8$c$J$$$N$G!"%j%=!<%9$,MW$j$^$9!#$^$?!“2J3X5;=Q7W;;$K:GE,2=$9$ke(B
e$B0Y$K$O!”<YKb$K$J$k$b$N$rGS=|$7$J$1$l$P$J$j$^$;$s!#B?MM$J%3!<%G%#%s%0%7e(B
e$B%9%F%`$N%5%]!<%H$J$I$O<YKb$K$J$k$+$b$7$l$^$;$s!#e(B

ruby e$B$,$"[email protected][email protected]$i$l$?$N$K!"<+J,$NETe(B
[email protected]$1<h$j=P$7$F!“B>$OMW$i$J$$!”$H$$$&[email protected]@NO$,$J$$$H;We(B
e$B$$$^$9!#e(B

[email protected]$C$F$^$;$s$h!<e(B ><
e$B$=$7$Fe(B Complex e$B$,$<$s$<$s4X78$J$$$8$c$J$$$G$9$+!<e(B >
<

ruby
e$B$r2J3X5;=Q7W;;$K:GE,2=$9$k$H$$$&$N$O!“FCDj$NMQES$KFC2=$9$k!”$H$$e(B
e$B$&$3$H$G$9$h$M!#8=<BE*$K$O!"[email protected]$j<N$F$kI,MW$,$"$k$H;W$$$^$9!#e(B

e$B$=$l$H$b!"B<ED$5$s$N$$$&:GE,2=$H$$$&$N$O!“C1$Ke(B ruby
e$B$N?tCM%/%i%9$N1i;;e(B
e$B$,[email protected]$1B.$/$J$k$h$&4hD%$k!”$H$$$&$3$H$J$s$G$7$g$&$+!#e(B

e$BB<ED$G$9!%e(B

2008/3/30 Tadayoshi F. [email protected]:

e$B:#2s!$J#AG?t%i%$%V%i%j$NAH9~$_2=$H$$$&J8L.$G$3$N$h$&[email protected]$K$J$C$F$$$k$o$1$G$9$,!$e(B
Ruby e$B$NJ#AG?t%i%$%V%i%j$,?tCM7W;;0J30$NL\E*$G;HMQ$5$l$k$H$7$?$i!$e(B
e$B$I$s$JMQES$,B?$$$s$G$7$g$&$M!%;d$O?tCM7W;;0J30$NL\E*$G;HMQ$7$?$3$H$,L5$$$N$G!$e(B
e$BJ#[email protected],$rIbF0>[email protected]?t0J30$K$7$?$$$H;W$C$?$3$H$,$"$j$^$;$s!%e(B

e$B$I$&$$$&MQES$,B?$$$+$OCN$j$^$;$s$,!“e(Bruby e$BA4BN$G9M$($l$P!”$$$o$f$k?tCMe(B
e$B7W;;0J30$G$D$+$C$F$$$k?M$N$[$&$,05E]E*$8$c$J$$$G$9$+!#e(B

Ruby e$B$NMQES$G$O$J$/J#AG?t%i%$%V%i%je(B (Complex e$B%/%i%9e(B)
e$B$NMQES$,CN$j$?$+$C$?$G$9$h$M!%e(B
e$B$=$7$F!$e(BRuby
e$B$N<g$JMQES$,?tCM7W;;$G$J$$$3$H$/$i$$$OCN$C$F$k$N$G8f0B?42<$5$$e(B ^^;

ruby e$B$OJ8;zNs=hM}$J$I$N$[$&$,8~$$$F$$$k$H;W$$$^$9!#$=$l$G$b!"?tCM1i;;e(B
[email protected]$OGS=|$5$l$F$$$^$;$s!#e(B

rails e$B$r$D$+$&?M$K$H$C$F$O!“e(Bruby e$B$Oe(B rails [email protected]$+$b$7$l$^$;$s!#$=$&$$$&e(B
e$B?M$K$O!“J#AG?t<+BN$,$”$^$jI,MW$G$O$”$j$^$;$s!#:n<T$N$^$D$b$H$5$s$b4^$a!“e(B
e$B05E]E*B??t$O!”$3$N7o$K6=L#$,$"$j$^$;$s!#e(B

e$B$3$l$He(B Complex e$B$O$I$&4X78$"$k$s$G$9$+$M!)e(B
Complex
e$B$N<BAu$,?tCM7W;;8~$1$N3HD%%b%8%e!<%k$r:n$j0W$$;EMM$KJQ99$5$l$k$H!$e(B
Rails e$B$,:$$C$?$j$9$k$s$G$9$+!);d$O$7$J$$$H;W$$$^$9$h!%e(B

ruby e$B$,$"[email protected][email protected]$i$l$?$N$K!"<+J,$NETe(B
[email protected]$1<h$j=P$7$F!“B>$OMW$i$J$$!”$H$$$&[email protected]@NO$,$J$$$H;We(B
e$B$$$^$9!#e(B

[email protected]$C$F$^$;$s$h!<e(B ><
e$B$=$7$Fe(B Complex e$B$,$<$s$<$s4X78$J$$$8$c$J$$$G$9$+!<e(B >
<

e$B86$G$9!#e(B

e$B$J$s$+H/[email protected]$7$F$$$k?M$?$A$NG$0U$NFs?M$G0U8+$,?)$$0c$C$F$k$_$?$$!D3’$5$se(B
e$B$O$I$&$+$7$l$^$;$s$,!";d$OA08~$-$KH/[email protected]$7$?$$$H;W$$$^$9!#;d$,8e$m8~$-$Ne(B
e$BH/[email protected]$r$7$?$H$9$l$P!";d$,8e$m8~$-$NH/[email protected]$r$7$h$&$H$7$F8e$m8~$-$NH/[email protected]$7$Fe(B
e$B$$$k$N$G$O$J$/!";d$O8e$m$rA0$H4*0c$$$7$F$$$k$N$G$9!#e(B

Tadayoshi F. wrote:

e$B:#$^$G$Ne(B Complex e$B$O!“e(Bcomplex.rb e$B$K$[$;D$7$F!”$?$H$($Pe(B Rational [email protected],e(B
e$B$NJ#AG?t$r;H$$$?$$?M$O!"e(BComplex e$B$r;H$$!“2J3X5;=Q7W;;$r$7$?$$?M$O!”$3e(B
e$B$Ne(B (2) e$B$r;H$(!D$G!"H,J}4]$/<}$^$k$N$G$O$J$$$G$7$g$&$+!#e(B

complex.rb e$B$O!"$$$m$$$mLdBj$J$j2]Bj$,$"$k$N$G!"$=$N$^$^$D$+$&$K$OL5M}$,e(B
e$B$"$k$H;W$$$^$9!#[email protected]$1$G$b%m%/$K%a%s%F$5$l$F$J$+$C$?$N$K!"$=$s$J$K$$e(B
e$B$m$$$mMQ0U$7$FBg>fIW$J$s$G$9$+!#e(B

e$BBg>fIW$+$C$F!)!D!D$I$&$J$s$G$7$g$&!#e(B

e$B$=$b$=$b!"86$5$s!"e(Bcomplex e$B$NAH$9~$<+BN$K>C6KE*[email protected]$C$?$s$G$9$h$M!#e(B

e$B$=$&$G$9!#e(BComplex e$B$,Fq$7$$!"$H$$$&OC$r=q$$$F$*$/$H!"e(B

e$BNc$($P!“e(Bz = Complex(1.0, 0) e$B$He(B z = Complex(1,
0)e$B!”$I$A$i$N%1!<%9$G$be(B

z.is_a?(Complex) && z == 1

e$B$O??$J$N$K!"e(Bz/2 e$B$O!"A0<T$G$Oe(B 0.5 e$B$KEy$7$/!"8e<T$G$Oe(B 0
e$B$KEy$7$$!#$D$^$j!“e(B
e$B$3$N%1!<%9$G$Oe(B Complex
e$B$O!”$b$H$N?t$r%i%C%W$7$FJ,$+$j$K$/$/$7$F$$$k!#e(B

complex.rb e$B$Ne(B Complex
e$B$O!"$$$o$f$kJ#AG?t$=$N$b$N$rI=$7$F$$$k$H$$$&$h$je(B
e$B$b!"!VJ#AG2=!W$rI=$7$F$$$k46$8$G$9!#$b$A$m$sBg$$$KB8:_0U5A$O$"$j$^$9!#e(B

e$B$=$3$G!“e(BFloat e$B$+$i$NN`?d$GJ,$+$j$d$9$$e(B
ComplexFloat(e$B2>e(B) e$B$,$”$l$P!"$h$je(B
e$BB(CM$C$]$/$FNI$$$N$G$O$J$$$+!"$H;W$C$?$N$G$9!#$3$l$K$O!"$b$H$b$He(B
Ruby
e$B$GJ#AG?t$N7W;;$r$7$?$$?M$O!“e(Bdouble
[email protected]:EY$N5;=QE*$J7W;;$r<j7Z$K9T$$$?$$>le(B
e$B9g$,B?$$!”$H$$$&M=B,$b$"$j$^$9!#e(BComplexFloat
e$B$H$$$&L>>N$O$$$^$$$A$+$b$7e(B
e$B$l$^$;$s!#e(B

e$B$A$J$_$K;d<+?H$Oe(B Complex e$B$r$"$^$j;H$$$^$;$s!#M-M}[email protected],$Ne(B
Complex e$B$O!“e(B
e$B;H$&$3$H$,$”$k$+$b!#e(B

e$B$G!"99$KNc$($Pe(B Math.sqrt e$B$NCM$G$9$,!"e(BMath.sqrt(-8)
e$B$r%(%i!<$K$7$J$$$J$i!"e(B
ComplexFloat(e$B2>e(B)e$B$K$7$?$i$I$&$+$H$$$&$N$,Ds0F$G$9!#e(B

e$B$A$J$_$Ke(B Math.sqrt(4) e$B$O!":#$^$GDL$je(B 2.0(Float)
e$B$H$7$^$9!#7k6I!“e(BMath.sqrt
e$B$O!”>o$Ke(B Float e$B$+e(B ComplexFloat(e$B2>e(B)
e$B$rJV$9$H$9$k$o$1$G$9!#e(B

e$B0J>e!"e(B

e$B<[email protected]$N8e!“e(Bcomplex.rb e$B$K$”$ke(B Complex
e$B$bAH$9~$$K$9$ke(B

e$B$H$$$&$3$H$,0l1~$NA0Ds$GH/[email protected]$7$F$$$^$9!#G0$N$?$a!#e(B

e$B$H$3$m$G!"$b$7$+$7$F$U$J$P$5$s$O!"e(BMath.sqrt(4) e$B$O!“e(BInteger
e$B$Ne(B 2 e$B$K$7$?e(B
e$B$$$H9M$($F$$$k$N$G$7$g$&$+!)e(BRationale$B!“e(BComplex
e$BAH$_9~$_8e!”%G%U%)%k%H$G!“e(B
mathn e$B$re(B require e$B$7$J$$>uBV$G!”%*%W%7%g%s$J$7$G!”$NOC$G$9!#e(B

e$B$=$&$G$9!#e(BComplex e$B$,Fq$7$$!"$H$$$&OC$r=q$$$F$*$/$H!"e(B

e$BNc$($P!“e(Bz = Complex(1.0, 0) e$B$He(B z = Complex(1, 0)e$B!”$I$A$i$N%1!<%9$G$be(B

z.is_a?(Complex) && z == 1

e$B$O??$J$N$K!"e(Bz/2 e$B$O!"A0<T$G$Oe(B 0.5 e$B$KEy$7$/!"8e<T$G$Oe(B 0 e$B$KEy$7$$!#$D$^$j!“e(B
e$B$3$N%1!<%9$G$Oe(B Complex e$B$O!”$b$H$N?t$r%i%C%W$7$FJ,$+$j$K$/$/$7$F$$$k!#e(B

e$B$=$l$O!"e(BComplex e$B$G$O$J$/!“e(Bruby e$B$Ne(B /
e$B1i;;;R$N?6Iq$$$,860x$J$N$G!“2r7h$9e(B
e$B$k$K$O!“e(B/ e$B$N$[$&$rJQ99$9$kI,MW$,$”$j$^$9$M!#e(BComplex
e$B$K8B$i$:!”$9$G$K0Je(B
e$BA0$+$i$”$k$3$H$G$9$h$M!#e(B

e$B$"$H$O!"MxMQ<T$,!"e(B/e$B!"e(Bdive$B!"e(Bfdive$B!"e(Brdiv
e$B$J$I$r$D$+$$$o$1$k$H!#e(B

e$BKM$H$7$F$O!"e(B/
e$B1i;;;R$N?6Iq$$$K$D$$$FA08~$-$K8!F$$7$F$[$7$$$G$9!#e(B

e$B<[email protected]$N8e!“e(Bcomplex.rb e$B$K$”$ke(B Complex e$B$bAH$9~$$K$9$ke(B

e$B:#$Ne(B trunk e$B$K$"$ke(B Complex e$B$N$I$N$"$?$j$,ITK~$G$9$+e(B?

e$B$H$3$m$G!"$b$7$+$7$F$U$J$P$5$s$O!"e(BMath.sqrt(4) e$B$O!“e(BInteger e$B$Ne(B 2 e$B$K$7$?e(B
e$B$$$H9M$($F$$$k$N$G$7$g$&$+!)e(BRationale$B!“e(BComplex e$BAH$_9~$_8e!”%G%U%)%k%H$G!“e(B
mathn e$B$re(B require e$B$7$J$$>uBV$G!”%*%W%7%g%s$J$7$G!”$NOC$G$9!#e(B

e$B2>$K8=;[email protected]$G$G$-$J$/$F$b!"$=$&[email protected]$r$D$^$J$$$h$&$K$7$?$$!"$H$$e(B
e$B$&$3$H$G$9$M!#86$5$s$N0F$G$O!“4pK\IbF0>[email protected]?t$N$_!”$*$^$1$GJ#AG?t!"$He(B
e$B$$$&[email protected]$H;W$$$^$9$,!#e(B

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

In message “Re: [ruby-dev:34187] Re: Complexe$BAH$_9~$_e(B”
on Mon, 31 Mar 2008 20:08:34 +0900, Tadayoshi F.
[email protected] writes:

|e$BKM$H$7$F$O!"e(B/ e$B1i;;;R$N?6Iq$$$K$D$$$FA08~$-$K8!F$$7$F$[$7$$$G$9!#e(B

e$B$4$a$s$J$5$$!#[email protected]$&!VA08~$-$K8!F$!W$H$O6qBNE*$K$I$N$h$&e(B
e$B$K$9$k$3$H$K$D$$$F8!F$$9$k$H$$$&$3$H$G$9$+!#$b$N$o$+$j$,$o$ke(B
e$B$/$F?=$7Lu$J$$$G$9$,!“J|CV$7$F$*$/$N$O$”$s$^$jNI$/$J$$$h$&$Je(B
e$B5$$,$7$?$b$N$G!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs