{Complex,Rational}::Unify

Complex e$B$He(B Rational e$B$G$O!“e(BUnify
e$B$,Dj5A$5$l$?>l9g!“[email protected][email protected],e(B
e$B2=$9$k!”$H$$$&;EAH$,$”$j$^$9!#%.%j%.%j$G$9$,!"$3$N5!G=$r$3$N$^$^;D$7$Fe(B
e$B$$$$$N$+3NG’$7$?$$$G$9!#e(B

e$B$3$N5!G=$O!“KX$Ie(B mathn [email protected]$G$9e(B
(e$B$”$A$3$A$G>!<j$K$D$+$o$l$F$b:$$ke(B)e$B!#AHe(B
e$B$9~$$N%/%i%9$,!"E:IU%i%$%V%i%j$N$?$a$KFCJL$JG[N8$r$3$&$$$&7A$G$9$k!"e(B
e$B$H$$$&$N$O$+$J$jJQ$C$F$$$k$H;W$$$^$9!#e(B

e$B$^$:!"@5<0$J;EMM$J$N$+N"5;$J$N$+!"@bL@$N$7Fq$$$b$N$,B8:_$9$k$3$H;vBV$,e(B
e$BK>$^$7$/$"$j$^$;$s!#e(B

e$B$?$$$7$?IiC4$G$O$"$j$^$;$s$,!"@55,2=$9$k$7$J$$$K$+$+$o$i$:!"7W;;$NEY$Ke(B
[email protected],2=$9$k$7$J$$$N8!::$r$7$J$1$l$P$J$i$J$$$N$b5$;}$o$k$$$G$9!#e(B

e$B$3$N7o$O0JA0$+$i5$$K$J$C$F$$$^$7$?$,!“EvLL$OF0$+$;$J$$$HD|$a$F$$$^$7$?!#e(B
e$B$7$+$7!”$3$N4V$Ne(B ** e$B$NDj5A$N7o$G!“e(Bruby
e$BB&$GBP=h$7$J$/$F$$$$$8$c$J$$!”$He(B
e$B$$$&0U8+$+$i5?Ld$K;W$$$O$8$a$^$7$?e(B
(e$BG<[email protected]$7$F$$$k$o$1$G$O$J$$e(B)e$B!#2?8N$3$le(B
e$BDx$Ke(B mathn e$B$KFCJL$JG[N8$,I,MW$J$N$G$7$g$&!#e(B

e$B$3$l$,5v$5$l$k$J$i$P!“e(BInteger::TrueDiv e$B$rDj5A$9$k$He(B 1 / 3
e$B$Ge(B Rational
e$B$,JV$k!”$J$s$F$3$H$b$G$-$=$&$G$9!#e(B

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

In message “Re: [ruby-dev:36461] {Complex,Rational}::Unify”
on Mon, 22 Sep 2008 19:59:43 +0900, Tadayoshi F.
[email protected] writes:

|Complex e$B$He(B Rational e$B$G$O!“e(BUnify e$B$,Dj5A$5$l$?>l9g!“[email protected][email protected],e(B
|e$B2=$9$k!”$H$$$&;EAH$,$”$j$^$9!#%.%j%.%j$G$9$,!"$3$N5!G=$r$3$N$^$^;D$7$Fe(B
|e$B$$$$$N$+3NG’$7$?$$$G$9!#e(B
|
|e$B$3$N5!G=$O!“KX$Ie(B mathn [email protected]$G$9e(B (e$B$”$A$3$A$G>!<j$K$D$+$o$l$F$b:$$ke(B)e$B!#AHe(B
|e$B$9~$$N%/%i%9$,!“E:IU%i%$%V%i%j$N$?$a$KFCJL$JG[N8$r$3$&$$$&7A$G$9$k!“e(B
|e$B$H$$$&$N$O$+$J$jJQ$C$F$$$k$H;W$$$^$9!#e(B
|
|e$B$^$:!”@5<0$J;EMM$J$N$+N"5;$J$N$+!”@bL@$N$7Fq$$$b$N$,B8:_$9$k$3$H;vBV$,e(B
|e$BK>$^$7$/$"$j$^$;$s!#e(B
|
|e$B$?$$$7$?IiC4$G$O$"$j$^$;$s$,!"@55,2=$9$k$7$J$$$K$+$+$o$i$:!"7W;;$NEY$Ke(B
|[email protected],2=$9$k$7$J$$$N8!::$r$7$J$1$l$P$J$i$J$$$N$b5$;}$o$k$$$G$9!#e(B
|
|e$B$3$N7o$O0JA0$+$i5$$K$J$C$F$$$^$7$?$,!“EvLL$OF0$+$;$J$$$HD|$a$F$$$^$7$?!#e(B
|e$B$7$+$7!”$3$N4V$Ne(B ** e$B$NDj5A$N7o$G!“e(Bruby e$BB&$GBP=h$7$J$/$F$$$$$8$c$J$$!”$He(B
|e$B$$$&0U8+$+$i5?Ld$K;W$$$O$8$a$^$7$?e(B (e$BG<[email protected]$7$F$$$k$o$1$G$O$J$$e(B)e$B!#2?8N$3$le(B
|e$BDx$Ke(B mathn e$B$KFCJL$JG[N8$,I,MW$J$N$G$7$g$&!#e(B

mathn.rbe$B$Oe(Bcomplex.rbe$B$J$I$HF10l$N:n<T$,F1;~$Ke(B(e$B0lBN$H$7$Fe(B)e$B:[email protected](B
[email protected]$C$?$N$G!"$=$N$h$&$JG[N8$,B8:[email protected]$H;W$$$^$9!#e(B

e$B$G!“e(Bcomplexe$B$J$I$,AH$9~$$K$J$C$?e(B(mathne$B$H0lBN$H$$J$5$l$J$/e(B
e$B$J$C$?e(B)e$B8=:
!”$=$N$h$&$J;EAH$_$,I,?$G$"$k$+$HLd$o$l$k$H!"I,e(B
e$B$:$7$b$=$&[email protected]$m$&$H;W$$$^$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36472 ] the message: "[ruby-dev:36472] Re:
{Complex,Rational}::Unify ", on Sep/23 07:37(JST) Tadayoshi F.
writes:

mathn.rbe$B$Oe(Bcomplex.rbe$B$J$I$HF10l$N:n<T$,F1;~$Ke(B(e$B0lBN$H$7$Fe(B)e$B:[email protected](B
[email protected]$C$?$N$G!"$=$N$h$&$JG[N8$,B8:[email protected]$H;W$$$^$9!#e(B

e$B:n$C$?Ev;[email protected][email protected]$1$G!"<BAu$KLdBj$,$"$C$?$o$1$G$O$J$+$C$?$He(B
e$B;W$$$^$9!#$7$+$7:#$O5R4QE*$K8+$F4qL/$K8+$($^$9$M!#e(B

e$B<BAu$KLdBj$J$+$C$?$H$$$&$H$=$&$G$b$J$$$H;W$C$F$$$^$7$?$,e(B,
e$B<h$j$"$($:$=e(B
e$B$&$J$C$F$$$?46$8$G$9e(B.

e$B8=:_e(B
complexe$B$,AH$9~$$K$J$C$?0J>e:#$N$h$&$J$b$N$O$h$m$7$/$J$$$H;d$b;We(B
e$B$$$^$9e(B.

e$B$3$N5!G=$rL58z$K$7$h$&$H;W$$$^$9!#2>$K8e!9$3$N5!G=$,$I$&$7$F$bI,MW$K$J$Ce(B
e$B$?$H$7$F$b!"8x<[email protected]$J$$$h$&$K;W$$$^$9!#e(B

e$B$^$:e(B, Unifye$B$J$7$GF0:n$9$k$h$&$Ke(B,
mathne$BB&$GBP1~$5$;$F$/[email protected]$5$$e(B. e$B$=$l$+$ie(B,
Rational/Complex e$B$NJ}[email protected]$1$k$H$"$j$,$?$$$G$9e(B.

e$B$3$N9M$($O=U$K5qH]$5$l$F!“e(Bmathn e$B$Oe(B mathn e$B$G4hD%$k!”$H$$$&$3$H$K$J$C$?$Ne(B
e$B$G$9$,!"$"$^$j4hD%$l$F$$$J$$$h$&$K8+$($^$9!#e(Bmathn e$B$,L;X$7$?$H$3$m$O5$e(B
e$B$KF~$C$F$$$^$9$,!“e(Bmathn e$B<+BN$O$”$^$j$&$^$/$$$C$F$$$J$$$N$G!">-MhE*$K$O!"e(B
e$BI,MW$J$ie(B ruby e$BB&$K$J$s$i$+$NJ}K!$G<h$j$3$`$J$I$7$F2r>[email protected]$H;W$$$^e(B
e$B$9!#e(B

e$B$H$$$&$+e(B, e$B6a$$>-Mhe(B

int / int -> Rational

e$B$K$J$k$H$9$l$Pe(B, e$B$=$N;~EvA3e(B,
[email protected],2=$O$O$$$k$3$H$K$J$k$He(B
e$B;W$$$^$9e(B.

complexe$B$K4X$7$F$Oe(B, e$B$=$N;[email protected]$Ge(BCMathe$B$G$9$+$M$'e(B…

e$B8=9Te(B(CMathe$B$J$7e(B)e$B$G$Oe(B,

i*i => -1

e$B$H$J$je(B,

sqrt(i * i) => i

e$B$K$J$i$J$/$J$k$N$Ge(B… e$B$b$7$/$Oe(B,
CMathe$BAjEv$N?6$kIq$$$,I8=`$N?6$kIq$$$Ke(B
e$B$J$k$+e(B…

e$B$=$&$9$l$Pe(B,
mathne$B$NLr3d$O$[$H$s$I=*$o$C$?$3$H$K$J$k$H;W$$$^$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$^$:e(B, Unifye$B$J$7$GF0:n$9$k$h$&$Ke(B, mathne$BB&$GBP1~$5$;$F$/[email protected]$5$$e(B. e$B$=$l$+$ie(B,
Rational/Complex e$B$NJ}[email protected]$1$k$H$"$j$,$?$$$G$9e(B.

e$B$"$"!"E`7k$b6a$$$N$G>/$7A0$K%3%_%C%H$7$F$7$^$$$^$7$?!#Bg>fIW$G$9$+$M!#e(B

i*i => -1

e$B$H$J$je(B,

sqrt(i * i) => i

e$B$K$J$i$J$/$J$k$N$Ge(B… e$B$b$7$/$Oe(B, CMathe$BAjEv$N?6$kIq$$$,I8=`$N?6$kIq$$$Ke(B
e$B$J$k$+e(B…

[email protected]$H$7$F$O!"e(Bsqrt [email protected]?t$dM-M}?t$bJV$;$k$N$G!“e(BMath
e$B$+e(B CMath e$B$+$H$$$&e(B
e$BJ,$1J}$,$I$&$+$H$$$&$N$b$”$j$^$9$M!#e(B

e$B$=$&$$$&J}[email protected]$,$O$C$-$j$7$F$$$l$P!“e(B**
e$B$NDj5A$bJQ$($F$h$+$C$?$+$J$H;W$$e(B
e$B$^$9!#$^$,$j$J$j$K$be(B CMath e$B$b$”$j$^$9$7!#e(B

e$B$=$&$$$($P!"e(Bpython e$B$be(B 2 e$B$G$O!"e(B(-8)(1.0/3)
e$B$,%(%i!<$K$J$j$^$9$,!"e(B3 e$B$Ge(B
e$B$O!"e(B(-8)
(1/3) e$B$GJ#AG?t$,JV$k$h$&$K$J$C$F$$$^$9!#e(B

from cmath import *
1j * 1j
(-1+0j)

sqrt(1j * 1j)
1j

1/3
0.33333333333333331

(-8)**(1/3)
(1.0000000000000002+1.7320508075688772j)

[email protected]> require ‘cmath’
#=> true
[email protected]> include CMath
#=> Object
[email protected]> Complex(0,1) * Complex(0,1)
#=> (-1+0i)
[email protected]> sqrt(Complex(0,1) * Complex(0,1))
#=> (0.0+1.0i)
[email protected]> 1/3
#=> 0
[email protected]> (-8)(1/3)
#=> 1
[email protected]> (-8)
(1.0/3)
#=> NaN
[email protected]> Complex(-8)**(1.0/3)
#=> (1.0+1.73205080756888i)

mathn.rbe$B$Oe(Bcomplex.rbe$B$J$I$HF10l$N:n<T$,F1;~$Ke(B(e$B0lBN$H$7$Fe(B)e$B:[email protected](B
[email protected]$C$?$N$G!"$=$N$h$&$JG[N8$,B8:[email protected]$H;W$$$^$9!#e(B

e$B:n$C$?Ev;[email protected][email protected]$1$G!"<BAu$KLdBj$,$"$C$?$o$1$G$O$J$+$C$?$He(B
e$B;W$$$^$9!#$7$+$7:#$O5R4QE*$K8+$F4qL/$K8+$($^$9$M!#e(B

e$B$G!“e(Bcomplexe$B$J$I$,AH$9~$$K$J$C$?e(B(mathne$B$H0lBN$H$$J$5$l$J$/e(B
e$B$J$C$?e(B)e$B8=:
!”$=$N$h$&$J;EAH$_$,I,?$G$"$k$+$HLd$o$l$k$H!"I,e(B
e$B$:$7$b$=$&[email protected]$m$&$H;W$$$^$9!#e(B

e$B$3$N5!G=$rL58z$K$7$h$&$H;W$$$^$9!#2>$K8e!9$3$N5!G=$,$I$&$7$F$bI,MW$K$J$Ce(B
e$B$?$H$7$F$b!"8x<[email protected]$J$$$h$&$K;W$$$^$9!#e(B

e$B0l1~IU$12C$($k$H!“5U$Ke(B ruby
e$B$K<h$j9~$s$G$7$^$&;v$b9M$($i$l$^$9!#%$%s%?e(B
e$B%W%j%?!“e(BVM e$B$N=i4|2=;[email protected]_Dj$G$-$k%U%i%0$rMQ0U$7$F!“e(Bruby
e$B$N=i4|>uBV$rJQe(B
e$B99$7$F$7$^$$$^$9!#$?$H$($P!“e(Bruby e$B$Ne(B -m
e$B%*%W%7%g%s$rM?$($F5/F0$9$k$H?t3Xe(B
e$B%b!<%I$K$J$k!”$”$k$$$Oe(B mruby
e$B$H$$$&JL$N%3%^%s%I$H$K$7$F$7$^$&!”$H$$$&$he(B
e$B$&$J$3$H$b$”[email protected]$k$H;W$$$^$9!#?t3X$J$^$j$Ne(B ruby
e$B$H$7$F!"K\Mh$Ne(B ruby e$B$He(B
e$B40A4$K6hJL$7$F$7$^$$$9!#CfESH>C<$J=q$-49$($r$9$k$h$j$$$$$H;W$$$^$9!#e(B

e$B$3$N9M$($O=U$K5qH]$5$l$F!“e(Bmathn e$B$Oe(B mathn
e$B$G4hD%$k!”$H$$$&$3$H$K$J$C$?$Ne(B
e$B$G$9$,!"$"$^$j4hD%$l$F$$$J$$$h$&$K8+$($^$9!#e(Bmathn
e$B$,L;X$7$?$H$3$m$O5$e(B
e$B$KF~$C$F$$$^$9$,!“e(Bmathn
e$B<+BN$O$”$^$j$&$^$/$$$C$F$$$J$$$N$G!">-MhE*$K$O!"e(B
e$BI,MW$J$ie(B ruby
e$BB&$K$J$s$i$+$NJ}K!$G<h$j$3$`$J$I$7$F2r>[email protected]$H;W$$$^e(B
e$B$9!#e(B

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36487 ] the message: "[ruby-dev:36487] Re:
{Complex,Rational}::Unify ", on Sep/23 23:07(JST)
Tadayoshi F. writes:

e$B$^$:e(B, Unifye$B$J$7$GF0:n$9$k$h$&$Ke(B, mathne$BB&$GBP1~$5$;$F$/[email protected]$5$$e(B. e$B$=$l$+$ie(B,
Rational/Complex e$B$NJ}[email protected]$1$k$H$"$j$,$?$$$G$9e(B.

e$B$"$"!"E`7k$b6a$$$N$G>/$7A0$K%3%_%C%H$7$F$7$^$$$^$7$?!#Bg>fIW$G$9$+$M!#e(B

mathne$BF0$+$J$/$J$C$F$$$k$H;W$&$N$Ge(B,
e$B$"$^$jBg>fIW$G$O$"$j$^$;$se(B.

e$B$=$l$Oe(B, e$B$H$b$+$/e(B, e$B$I$&BP1~$9$k$+$G$9$,e(B.

e$B$$$^$Ne(B, rational.c complex.c e$B$N<[email protected]$He(B,
mathne$B$N$[$&$G$Oe(B, e$B;MB’1i;;$=$Ne(B
e$BB>$r$9$Y$F:FDj5A$9$kI,MW$,=P$F$-$=$&$G$9e(B.

[email protected]$H0J2<$N4X?te(B:

nurat_s_canonicalize_internal_no_reduce
nurat_s_canonicalize_internal_no_reduce

e$B$b$7$/$Oe(B,

nurat_s_new_internal

e$B$re(B, Complex [email protected]$H0J2<$N4X?te(B:

nucomp_s_canonicalize_internal

e$B$b$7$/$Oe(B,

nucomp_s_new_internal

e$B$re(B
Rubye$B%l%Y%k$G8F$S=P$;$k$h$&[email protected]$1$k$H$&$l$7$$$N$G$9$,e(B?

[email protected]$H$7$F$O!"e(Bsqrt [email protected]?t$dM-M}?t$bJV$;$k$N$G!“e(BMath e$B$+e(B CMath e$B$+$H$$$&e(B
e$BJ,$1J}$,$I$&$+$H$$$&$N$b$”$j$^$9$M!#e(B

e$B$?$7$+$Ke(B, e$B$=$l$O$$$($^$9$M$'e(B…

e$B$=$&$$$&J}[email protected]$,$O$C$-$j$7$F$$$l$P!“e(B** e$B$NDj5A$bJQ$($F$h$+$C$?$+$J$H;W$$e(B
e$B$^$9!#$^$,$j$J$j$K$be(B CMath e$B$b$”$j$^$9$7!#e(B

e$B$=$&$$$($P!"e(Bpython e$B$be(B 2 e$B$G$O!"e(B(-8)(1.0/3) e$B$,%(%i!<$K$J$j$^$9$,!"e(B3 e$B$Ge(B
e$B$O!"e(B(-8)
(1/3) e$B$GJ#AG?t$,JV$k$h$&$K$J$C$F$$$^$9!#e(B

e$B$U!<$se(B… e$B2?$H$J$/IT;W5De(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

mathne$BF0$+$J$/$J$C$F$$$k$H;W$&$N$Ge(B, e$B$"$^$jBg>fIW$G$O$"$j$^$;$se(B.

e$B%.%j%.%j$G?=$7J,$1$"$j$^$;$s!#e(B

nurat_s_new_internal

e$B$re(B, Complex [email protected]$H0J2<$N4X?te(B:

nucomp_s_canonicalize_internal

e$B$b$7$/$Oe(B,

nucomp_s_new_internal

e$B$re(B Rubye$B%l%Y%k$G8F$S=P$;$k$h$&[email protected]$1$k$H$&$l$7$$$N$G$9$,e(B?

e$B$=$l$O$I$&$J$s$G$7$g$&$+!#=q$-49$($H$J$k$H!"$3$l$i$r8F$S=P$90UL#$O$J$$e(B
e$B$h$&$J5$$,$9$k$s$G$9$,!#@55,2=$5$l$k>l9g$O!“8F$S=P$9I,MW$,$J$$$7!”$=$le(B
e$B0J30$N>l9g$G$be(B Rational.convert
e$B$J$I$r8F$Y$P$$$$$h$&$J5$$,$7$?$N$G$9$,!#e(B

[email protected]$H;W$$$^$9!#$=$3$^$G$d$i$J$$$He(B
e$B$$$1$J$$$H$9$k$H!"e(BUnify
e$B$rDj5A$7$F1>!9$H$$$&OC$HHf$Y$F$b$^[email protected]$($Je(B
e$B$$$h$&$K;W$$$^$9!#e(B

e$B$=$&$$$($P!"e(Bpython e$B$be(B 2 e$B$G$O!"e(B(-8)(1.0/3) e$B$,%(%i!<$K$J$j$^$9$,!"e(B3 e$B$Ge(B
e$B$O!"e(B(-8)
(1/3) e$B$GJ#AG?t$,JV$k$h$&$K$J$C$F$$$^$9!#e(B

e$B$U!<$se(B… e$B2?$H$J$/IT;W5De(B.

mathn e$B$b4pK\E*[email protected]$H;W$$$^$9$,!#e(Bcmath
e$B$O$H$b$+$/!"??$CEv$K?J2=$7e(B
e$B$F$$$k$h$&$K8+$($^$9!#e(B

[email protected]$5$s$,$I$&9M$($F$$$k$+$o$+$j$^$;$s$,!"$I$s$I$s=q$-49$($F$$$/!"$H$$e(B
e$B$&J}K!$J$i$3$&$$$&$N$G$b$$$$$N$+$b!#$I$C$A$K$7$F$b0l;~N?$.$C$F46$8$G$9e(B
e$B$1$I!#e(B

Index: lib/mathn.rb

— lib/mathn.rb (revision 19552)
+++ lib/mathn.rb (working copy)
@@ -18,19 +18,76 @@
Math = CMath
end

+class Object
+

  • def canon
  • if Rational === self
  •  if denominator == 1
    
  • return numerator
  •  end
    
  • elsif Complex === self
  •  if Integer === imag && imag == 0
    
  • return real
  •  end
    
  • end
  • self
  • end
  • private :canon

+end
+
+class Numeric
+

  • class << self
  • def def_canon(*ids)
  •  for id in ids
    
  • module_eval <<-“end;”
  • alias_method :#{id.object_id}, :#{id.to_s}
  • private :#{id.object_id}
  • def #{id.to_s}(*args, &block)
  •  __#{id.object_id}__(*args, &block).__send__(:canon)
    
  • end
  • end;
  •  end
    
  • end
  • end

+end
+
class Fixnum
remove_method :confused:
alias / quo
+

  • def_canon *(instance_methods - Object.methods - [:canon])

end

class Bignum
remove_method :confused:
alias / quo
+

  • def_canon *(instance_methods - Object.methods - [:canon])

end

+alias RationalOrig Rational
+private :RationalOrig
+def Rational(*args) RationalOrig(*args).send(:canon) end
+
class Rational
Unify = true

  • class << self

  • alias convert_orig convert

  • private :convert_orig

  • def convert(*args) convert_orig(*args).send(:canon) end

  • end

  • def_canon *(instance_methods - Object.methods - [:canon])

  • alias power! **

    def ** (other)
    @@ -169,6 +226,39 @@
    module_function :rsqrt
    end

+alias ComplexOrig Complex
+private :ComplexOrig
+def Complex(*args) ComplexOrig(*args).send(:canon) end
+
class Complex
Unify = true
+

  • class << self
  • alias convert_orig convert
  • private :convert_orig
  • def convert(*args) convert_orig(*args).send(:canon) end
  • end
  • def_canon *(instance_methods - Object.methods - [:canon])

end
+
+class NilClass
+

  • def to_r() 0 end
  • def to_c() 0 end

+end
+
+class Integer
+

  • def to_r() self end
  • def to_c() self end

+end
+
+class Float
+

  • def_canon *(instance_methods - Object.methods - [:canon])

+end

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36565 ] the message: "[ruby-dev:36565] Re:
{Complex,Rational}::Unify ", on Sep/25 21:31(JST) Tadayoshi F.
writes:

[email protected]$5$s$,$I$&9M$($F$$$k$+$o$+$j$^$;$s$,!"$I$s$I$s=q$-49$($F$$$/!"$H$$e(B
e$B$&J}K!$J$i$3$&$$$&$N$G$b$$$$$N$+$b!#$I$C$A$K$7$F$b0l;~N?$.$C$F46$8$G$9e(B
e$B$1$I!#e(B

e$B;w$?$3$H$O$9$k$3$H$K$J$kCN$l$^$;$se(B.

[email protected](B,
Complex/Rationale$B0J30$Ne(BNumerice$B$KBP$7$F$NCV$-49$($OI,MW$J$$$H;W$$e(B
e$B$^$9e(B.
e$B8=>u$G$O$=$l$i$N%/%i%9$N%a%=%C%I$Ge(BComplex/Rationale$B$rJV$9$b$N$O$4e(B
e$B$/8B$i$l$F$$$^$9$+$ie(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36561 ] the message: "[ruby-dev:36561] Re:
{Complex,Rational}::Unify ", on Sep/25 18:54(JST) Tadayoshi F.
writes:

e$B$re(B Rubye$B%l%Y%k$G8F$S=P$;$k$h$&[email protected]$1$k$H$&$l$7$$$N$G$9$,e(B?

e$B$=$l$O$I$&$J$s$G$7$g$&$+!#=q$-49$($H$J$k$H!"$3$l$i$r8F$S=P$90UL#$O$J$$e(B
e$B$h$&$J5$$,$9$k$s$G$9$,!#@55,2=$5$l$k>l9g$O!“8F$S=P$9I,MW$,$J$$$7!”$=$le(B
e$B0J30$N>l9g$G$be(B Rational.convert e$B$J$I$r8F$Y$P$$$$$h$&$J5$$,$7$?$N$G$9e(B
e$B$,!#e(B

e$B$3$l$i$N%a%=%C%I$r8F$S=P$9$N$G$O$J$/e(B,
e$B:FDj5A$9$k$3$H$K$h$C$F?6$kIq$$$re(B
e$BJQ$($h$&$H;W$C$?$o$1$G$9e(B.

[email protected]$H;W$$$^$9!#$=$3$^$G$d$i$J$$$He(B
e$B$$$1$J$$$H$9$k$H!"e(BUnify e$B$rDj5A$7$F1>!9$H$$$&OC$HHf$Y$F$b$^[email protected]$($Je(B
e$B$$$h$&$K;W$$$^$9!#e(B

[email protected]$C$F$be(B,
publice$B$K$9$kI,MW$O$J$/e(Bprivatee$B$G$+$^$$$^$;$se(B. e$B$=$l$G$be(B
NGe$B$G$9$+e(B? Rubye$BE*$K$Oe(Bprivatee$B$G$"$l$Pe(B,
e$B$=$l$OFbIt$G;H$&$b$N$H$$$&$3$H$Ke(B
e$B$J$k$N$Ge(B, e$B$=$l$[$ILdBj$J$$$H;W$$$^$9$,e(B?

e$B>-MhE*$K;MB’1i;;$,e(Bmathne$BE*$K$J$k$3$H$,M=B,$5$le(B,
e$B$=$&$J$C$?$H$-$K$O:#$“e(B
e$B$k%3!<%[email protected]$1$G:Q$`[email protected]$1$J$N$Ke(B,
(e$B$3$N$h$&[email protected]$1e(B
e$B$J$$$J$ie(B, ) mathn.rb e$BB&$Ge(B,
Rational/[email protected]$N$”$k1i;;;Re(B,
e$B%a%=%C%I$r$9$Y$F:FDj5A$7$J$/$F$O$J$i$J$/$J$k$N$Oe(B,
e$B>/!9LLE]$H$$$&$+e(B2e$BEYe(B
e$B<[email protected]$&$+e(B… e$B$H;W$C$?$o$1$G$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$3$l$i$N%a%=%C%I$r8F$S=P$9$N$G$O$J$/e(B, e$B:FDj5A$9$k$3$H$K$h$C$F?6$kIq$$$re(B
e$BJQ$($h$&$H;W$C$?$o$1$G$9e(B.

e$B$h$&$9$k$K!“e(Bruby e$B$+$i8F$Y$k$H$$$&$h$j!”$`$7$me(B
Complex/Rational e$B$+$ie(B
ruby e$B$NDj5A$r8F$Y!"$H$$$&$3$H$G$9$h$M!#e(B

[email protected]$C$F$be(B, publice$B$K$9$kI,MW$O$J$/e(Bprivatee$B$G$+$^$$$^$;$se(B. e$B$=$l$G$be(B
NGe$B$G$9$+e(B? Rubye$BE*$K$Oe(Bprivatee$B$G$"$l$Pe(B, e$B$=$l$OFbIt$G;H$&$b$N$H$$$&$3$H$Ke(B
e$B$J$k$N$Ge(B, e$B$=$l$[$ILdBj$J$$$H;W$$$^$9$,e(B?

NG e$B$G$7$g$&!#@5D>$$$C$F:G0-$NItN`$+$b!#e(B

e$B>-MhE*$K;MB’1i;;$,e(Bmathne$BE*$K$J$k$3$H$,M=B,$5$le(B, e$B$=$&$J$C$?$H$-$K$O:#$“e(B
e$B$k%3!<%[email protected]$1$G:Q$`[email protected]$1$J$N$Ke(B, (e$B$3$N$h$&$JBP1~$r$7$F$$[email protected]$1e(B
e$B$J$$$J$ie(B, ) mathn.rb e$BB&$Ge(B, Rational/[email protected]$N$”$k1i;;;Re(B,
e$B%a%=%C%I$r$9$Y$F:FDj5A$7$J$/$F$O$J$i$J$/$J$k$N$Oe(B, e$B>/!9LLE]$H$$$&$+e(B2e$BEYe(B
e$B<[email protected]$&$+e(B… e$B$H;W$C$?$o$1$G$9e(B.

[email protected][email protected]$1!W$C$F$$$&$N$O$=$&$J$N$+$b$7$l$^$;$s$,!"2DG=$G$"e(B
e$B$k$J$i$P!"KM$+$i$9$l$P>/!9LLE]$G$be(B mathn
e$B$G:[email protected]$1!W$C$F;W$C$Fe(B
e$B$7$^$$$^$9!#$3$l$Oe(B mathn e$B$,$d$k$Y$-;v$J$N$G!#e(B

e$B$^$C$?$/$NFbIt;v>p$GMQ0U$5$l$?$b$N$D$$$F!“e(BComplex/Rational
e$BFbIt$G$NMxMQe(B
e$B$b4^$a$F!”$9$Y$Fe(B VM
[email protected]\8F$S=P$7$7$J$/$F$O$J$i$J$/$J$j$^$9!#FbIte(B
e$B$NET9g$G4JC1$KJQ99$b$G$-$J$/$J$j$^$9$7!"$3$l$O0lBN2=$G$O$J$$$G$9$+!#e(B

mathn
e$B$O7k6I%O%C%/[email protected]$H;W$$$^$9$,!"$=$N$?$a$KM=$aN"8}$r3+$1$F$*$1!"$C$Fe(B
e$B;[email protected]$H;W$$$^$9!#<B:]$N$H$3$m!"@PDM$5$s$,Ds0F$7$F$$$k:FDj5A$O!"$^$o$j$/e(B
[email protected]$1$G=`Hw$O$3$C$A$G$d$k$3$H$K$J$k$o$1$G$9$+$i!"<B<A!"e(Bmathn
e$B$O%9%#%Ce(B
e$B%[email protected]$1$H$$$C$F$$$$$H;W$$$^$9!#e(B

e$B$J$K$,$J$s$G$be(B mathn
e$BB&$G$OBP=h$G$-$J$$$H$$$&$N$G$"$l$P!"$b$&>/$7$^$7$He(B
e$B;W$($k9M$($b$"$j$^$9$,!“e(Bmathn
e$B$G$J$s$H$+$G$-$k$J$i2DG=$J8B$j$=$&$9$Y$-e(B
[email protected]$H;W$$$^$9!#E`7k;~9o$O2a$.$F$7$^$$$^$7$?$,!”$h$m$7$/$*4j$$$7$^$9!#e(B

e$BEvA3e(B, mathne$B$GBP1~$9$k$3$H$O$G$-$^$9e(B.

e$B$,e(B, e$B$3$NLdBj$O$U$J$P$5$s$,[email protected]$r$J$s$NF10U$b$J$/JQ99$7$?$3$H$Ke(B
e$B$"$j$^$9e(B. e$B;d$H$7$F$Oe(B, e$B$3$NJQ99$KBP$7$Fe(B, e$B:G>.8B$NJQ99$GBP1~$9$k$?$a$K8re(B
e$B>D$7$F$-$^$7$?$,e(B, e$B8r>D$O0UL#$,$J$+$C$?$h$&$G$9e(B.

e$B$=$l$O$^$C$?$/0c$$$^$9!#e(B[ruby-dev:36468]
e$B$G!"$^$D$b$H$5$s$b0U5A$rG’$a$Fe(B
e$B$$$^$9$7!“e(B[ruby-dev:36483]
[email protected]$5$s$b0U5A$rG’$a$F$$$^$9!#JQ99$r5^[email protected](B
e$B$N$OE`[email protected]$C$?$+$i$G!”@PDM$5$s$bD>[email protected]@$7$F$$$^$9!#e(B

e$B;d$H$7$F$Oe(B, e$B$9$G$KB8:_$9$k%i%$%V%i%[email protected]$b$J$/FHCGE*$Ke(BAPIe$B$re(B
e$BJQ99$7$?J}$,@dBPE*$K0-$$$H9M$($F$$$^$9$N$Ge(B, rational.c/complex.c e$B$re(B
mathne$B$,F0:n$9$k>uBV$KLa$9$+e(B, e$B$=$b$=$be(B rational.c/complex.c e$B$rF3F~$7$?e(B
e$B$N$,Aa$9$.$?$H$$$($J$/$b$J$$$G$9e(B. ruby-1.9.1e$B$G$O$5$i$KAL$C$Fe(B, 1.8e$B$Ne(B
rational.rb/complex.rbe$B$KLa$9$3$H$rDs0F$7$^$9e(B.

e$B0-$$$H$+$=$&$$$&LdBj$8$c$J$$$H;W$$$^$9$M!#JQ99$9$kA0$K!">/$7D4$Y$?$s$Ge(B
e$B$9$,!“e(BUnify
e$B$rDj5A$7$?$i?6Iq$$$,JQ99$K$J$k!”$H$$$&$N$O!"8x<0$K$bHs8x<0e(B
e$B$K$bJ8=q$G$O8l$i$l$F$$$J$$$H;W$$$^$9!#e(B

e$BKM$H$7$F$O!"@PDM$5$s$N0U;V$r$+$J$jB:=E$7$F$-$?$D$b$j$G$9!#$=$l$O!“e(B
Complex/Rational
e$B$N86:n<[email protected]$+$i$G$9$1$I!#<B:][email protected]$5$s$K$9$Y$F$*e(B
e$B;G$$$rN)$F$J$1$l$P$J$i$J$$$H;W$C$F$$$J$$$N$G$9$,!”:#2s$b!"@PDM$5$s$NOCe(B
e$B$rJ9$$$F$$$^$9$M!#e(B

e$B85$KLa$9$H$$$&$N$b!"?=$7Lu$J$$$G$9$,!“e(Brationrl.rbe$B!“e(Bcomplex.rbe$B!“e(B
mathn.rb
e$B$NJ|CV$V$j!”:#2s$K$7$F$bLLE][email protected]$+$i!”$H$$$&[email protected]$$J}$G$9$+$i!#KM$He(B
e$B$7$F$O!”$J$s$J$i<+J,$GD>$7$F$b$$$$$J$H;W$$$^$7$?$,!"@PDM$5$s$Ne(B
mathn e$B$Oe(B
e$B<+J,$G4hD%$j$?$$!"$H$$$&0U;V$rB:=E$7$?$D$b$j$G$9!#e(B

e$B$5$i$K$$$($Pe(B, e$B:#2s$N$U$J$P$5$s$NFHCGE*$JJQ99e(B/e$BBP1~$OA4$/G<[email protected]$,$$$-$^$;e(B
e$B$se(B. e$B3HD%%i%$%V%i%jE:IU%i%$%V%i%j$J$i$^[email protected]$7$bAH$9~$%/%i%9$K4X$9$kJQe(B
e$B99$K4X$9$k$3$H$J$N$G$3$H$5$i$G$9e(B. rational.c/complex.c e$B$K4X$7$F$Oe(B, e$B<Be(B
e$B:]$K$O86%3!<%Ie(B, [email protected]%3!<%Ie(B, e$B$=$NB>$HJ#?t$N<BAu$,$"$k$N$Ge(B, e$B$b$C$H$^$H$be(B
e$B$K%a%s%F%J%s%9$G$-$kJ}e(B(e$B>e5-$N0UL#$Ge(B)e$B$N%3!<%I$KJQ99$r$9$k$3$H$b4^$a$F8!e(B
e$BF$$9$kI,MW$,$"$k$H;W$$$^$9e(B.

e$BAH$9~$[email protected]$+$i$3$=!"e(Bmathn
e$B$N>!<j$K$G$-$J$$$G$9!#:#[email protected]$5$s$N<gD%$Oe(B
e$B$`$7$m!"e(BComplex/Rational
e$B$r;dJ*2=$7$F$$$k$h$&$K8+$($k$s$G$9$h!#$A$g$C$He(B
[email protected][email protected]$H;W$$$^$9!#e(B

e$B$3$NLdBj$KBP$7$F$Oe(B, e$BEvA3$U$J$P$5$s$G$O7hDj$G$-$^$;$s$N$Ge(B, e$B$^$D$b$H$5$se(B
e$B$K:[Dj$r$*4j$$CW$7$^$9e(B.

e$B$=$l$O>!<j$K$I$&$>!#e(B

[email protected]!“4{$K$$$C$?$h$&$K!”%.%j%.%j$K$J$C$Fe(B mathn
e$B$K$b1F6A$,$G$k$h$&$K$J$Ce(B
e$B$?$N$O?=$7J,$1$J$$!"$H;W$C$F$$$^$9!#8@$$Lu$a$$$F$$$^$9$,!"$7$+$7$=$l$be(B
[email protected]$5$s$X$NG[N8!“1sN8$,$”$C$?$3$H$b1F6A$7$F$$$k$H;W$$$^$9!#=c?h$Ke(B
Complex/Rational e$B$N;v$r9M$($l$P!"$b$C$HAa$/7hCG$9$Y$-$G$7$?!#e(B

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36605 ] the message: "[ruby-dev:36605] Re:
{Complex,Rational}::Unify ", on Sep/26 20:21(JST) Tadayoshi F.
writes:

e$B$J$K$,$J$s$G$be(B mathn e$BB&$G$OBP=h$G$-$J$$$H$$$&$N$G$"$l$P!"$b$&>/$7$^$7$He(B
e$B;W$($k9M$($b$"$j$^$9$,!“e(Bmathn e$B$G$J$s$H$+$G$-$k$J$i2DG=$J8B$j$=$&$9$Y$-e(B
[email protected]$H;W$$$^$9!#E`7k;~9o$O2a$.$F$7$^$$$^$7$?$,!”$h$m$7$/$*4j$$$7$^$9!#e(B

e$BEvA3e(B, mathne$B$GBP1~$9$k$3$H$O$G$-$^$9e(B.

e$B$,e(B,
e$B$3$NLdBj$O$U$J$P$5$s$,[email protected]$r$J$s$NF10U$b$J$/JQ99$7$?$3$H$Ke(B
e$B$"$j$^$9e(B. e$B;d$H$7$F$Oe(B, e$B$3$NJQ99$KBP$7$Fe(B,
e$B:G>.8B$NJQ99$GBP1~$9$k$?$a$K8re(B
e$B>D$7$F$-$^$7$?$,e(B, e$B8r>D$O0UL#$,$J$+$C$?$h$&$G$9e(B.

e$B;d$H$7$F$Oe(B,
e$B$9$G$KB8:_$9$k%i%$%V%i%[email protected]$b$J$/FHCGE*$Ke(BAPIe$B$re(B
e$BJQ99$7$?J}$,@dBPE*$K0-$$$H9M$($F$$$^$9$N$Ge(B, rational.c/complex.c
e$B$re(B
mathne$B$,F0:n$9$k>uBV$KLa$9$+e(B, e$B$=$b$=$be(B rational.c/complex.c
e$B$rF3F~$7$?e(B
e$B$N$,Aa$9$.$?$H$$$($J$/$b$J$$$G$9e(B.
ruby-1.9.1e$B$G$O$5$i$KAL$C$Fe(B, 1.8e$B$Ne(B
rational.rb/complex.rbe$B$KLa$9$3$H$rDs0F$7$^$9e(B.

e$B$5$i$K$$$($Pe(B,
e$B:#2s$N$U$J$P$5$s$NFHCGE*$JJQ99e(B/e$BBP1~$OA4$/G<[email protected]$,$$$-$^$;e(B
e$B$se(B.
e$B3HD%%i%$%V%i%jE:IU%i%$%V%i%j$J$i$^[email protected]$7$bAH$9~$%/%i%9$K4X$9$kJQe(B
e$B99$K4X$9$k$3$H$J$N$G$3$H$5$i$G$9e(B. rational.c/complex.c
e$B$K4X$7$F$Oe(B, e$B<Be(B
e$B:]$K$O86%3!<%Ie(B, [email protected]%3!<%Ie(B,
e$B$=$NB>$HJ#?t$N<BAu$,$"$k$N$Ge(B, e$B$b$C$H$^$H$be(B
e$B$K%a%s%F%J%s%9$G$-$kJ}e(B(e$B>e5-$N0UL#$Ge(B)e$B$N%3!<%I$KJQ99$r$9$k$3$H$b4^$a$F8!e(B
e$BF$$9$kI,MW$,$"$k$H;W$$$^$9e(B.

e$B$3$NLdBj$KBP$7$F$Oe(B, e$BEvA3$U$J$P$5$s$G$O7hDj$G$-$^$;$s$N$Ge(B,
e$B$^$D$b$H$5$se(B
e$B$K:[Dj$r$*4j$$CW$7$^$9e(B.

PS.
e$B>>K$5$s$OCN$C$F$$$k$H;W$$$^$9$,e(B,
e$B:#=5$O5Y2KCf$G$9$N$G$"$^$jH?1~$O$G$-e(B
e$B$J$$$H$*$b$$$^$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$BJdB-$7$^$9!#e(B

e$BJL$K:#2s$N7o!“[email protected]$+$iFHCGE*[email protected]$+$i!”@Z$l$F$k$o$1$8$c$J$$$G$9$h$M!#e(B

[email protected]$9$k;v$K$OF10U$7$F$$$k$o$1$G$9!#[email protected]!"[email protected]$7$F$d$k$+$i!“[email protected]$&DLe(B
e$B$j$K$7$m!”[email protected][email protected]$l$F$k$o$1$8$c$J$$$G$9$+!#e(B

e$BKM$Oe(B [ruby-dev:36472] e$B$G!"e(B

e$B$3$N5!G=$rL58z$K$7$h$&$H;W$$$^$9!#2>$K8e!9$3$N5!G=$,$I$&$7$F$bI,MW$K$J$Ce(B
e$B$?$H$7$F$b!"8x<[email protected]$J$$$h$&$K;W$$$^$9!#e(B

e$B$H0E$KI|[email protected]$b<($7$F$$$^$9!#K\Ev$KLdBj$J$i!"La$9;v$b$G$-$^$7$?!#e(B

mathn
e$B$GBP1~$G$-$J$$$J$iB>$K9M$($b$"$k!"$H$$$&$3$H$b0U<1E*[email protected]$Ce(B
e$B$F$$$^$9!#$7$+$7!"@PDM$5$s$Oe(B ruby
e$BB&$G=PMh$k!"$H$3$l$^[email protected]$C$Fe(B
e$B$$$^$9!#@PDM$5$s$O>/!9LLE][email protected][email protected]$$$^$;$s!"$=$s$JM}M3$G6Z0c$$$Je(B
e$BMW5a$r0{$`$3$H$O$G$-$^$;$s!#e(B

e$B;~4VE*$J;v$b$"$k$N$G!"@PDM$5$s$N9M$($r?dB,$7$F%Q%C%A$b=P$7$^$7$?$7!"$de(B
e$B$k$Y$-;v$O$d$C$F$$$k$D$b$j$G$9!#e(B

e$BFMA3$H$+!“[email protected]$&$J$i!“B>$K$b;_$a$F$b$i$&?M$,$$$k$G$7$g$&!#7+$jJVe(B
e$B$7$^$9$,!”>!<j$KJQ99$7$?$o$1$G$O$”$j$^$;$s!#:G0-85$KLa$9;v$b9M$($F$d$Ce(B
e$B$F$$$^$9!#e(B

[email protected]$5$s$K%a%s%F%J<:[email protected]$o$l$k6Z9g$O$J$$$H;W$$$^$9!#e(B

e$B$3$N4V!"e(Bmathn e$B$G!"e(B

(-8)(1/3) #=> (1.0+1.73205080756888i)
(-8.0)
(1/3) #=> NaN

e$B$H$$$&IT0lCW$K$D$$$FOC$7$^$7$?$,!"$=$N8e$b$^$C$?$/F0$-$,$"$j$^$;$s!#e(B

1.8 e$B$Ne(B complex.rbe$B!"e(Brational.rbe$B!“e(Bmathn.rb
e$B$K$D$$$F$bMM!9$J2]Bj$,$”$C$F!"e(B
([email protected]$5$s$,2?$b$7$J$$$N$Ge(B)
e$B$$$/$D$+$OKM$,%Q%C%A$r=q$-$^$7$?!#$b$&$h$/21e(B
e$B$($F$$$^$;$s$,!"A4It$OD>$7$F$$$J$+$C$?$H;W$$$^$9!#@PDM$5$s$,2?$+$r$9$ke(B
e$B;v$OKX$I$J$$$G$9$h$M!#@PDM$5$s$O$=$&$$$&;v$K$b$^$C$?$/4X?4$,$J$$$h$&$Ge(B
e$B$9!#e(B

e$B$?$H$($P!"KM0J30$N?M$b7+$jJV$7;XE&$7$F$$$?$H;W$$$^$9$,!"e(B

Rationa.new(1,2) e$B$O%W%i%$%Y!<%H%a%=%C%I$G%(%i!<$K$J$k$N$K!“e(B
Complex.new(1,2) e$B$OBg>[email protected]$H$+!”$$$m$$$m$"$k$o$1$G$9!#e(B

[email protected]$5$s$K$OITK\0U$J$H$3$m$b$"$k$N$+$b$7$l$^$;$s$,!“e(BUnify
e$B$rF3F~$7$?$Ne(B
[email protected]$5$s$G$9!#e(Bmathn
[email protected]$,LLE][email protected][email protected]$C$FJ”$,N)$D$N$b!"$b$&5$NO$,e(B
e$B$J$$$+$i$8$e$J$$$G$9$+!#<+J,$N;v$8$c$J$$$G$9$+!#e(B

[email protected]$5$s$N$[$&[email protected]$J8"NO;}$C$F$k$N$G!"KM$OIi$1$k$+$b$7$l$^$;$s$,!“4Ve(B
e$B0c$C$F$J$$$H;W$$$^$9!#>/$J$/$H$b!”@PDM$5$s$K%0%[email protected]$o$l$kDx$Ne(B
e$B;v$r$7$^$7$?$+!#e(B

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

In message “Re: [ruby-dev:36608] Re: {Complex,Rational}::Unify”
on Sat, 27 Sep 2008 02:05:07 +0900, [email protected]
([email protected]=<ye(B) writes:

|e$B;d$H$7$F$Oe(B, e$B$9$G$KB8:_$9$k%i%$%V%i%[email protected]$b$J$/FHCGE*$Ke(BAPIe$B$re(B
|e$BJQ99$7$?J}$,@dBPE*$K0-$$$H9M$($F$$$^$9$N$Ge(B, rational.c/complex.c e$B$re(B
|mathne$B$,F0:n$9$k>uBV$KLa$9$+e(B, e$B$=$b$=$be(B rational.c/complex.c e$B$rF3F~$7$?e(B
|e$B$N$,Aa$9$.$?$H$$$($J$/$b$J$$$G$9e(B. ruby-1.9.1e$B$G$O$5$i$KAL$C$Fe(B, 1.8e$B$Ne(B
|rational.rb/complex.rbe$B$KLa$9$3$H$rDs0F$7$^$9e(B.

e$B;d$K$Oe(Bcomplex,rational,mathne$B$G0lBN$G$"$C$?$b$N$,!":#2sA0Fs<Te(B
[email protected]$1$U$J$P$5$s$,%a%s%F%J$K$J$C$?$?$a!":#$^$G30$K=P$F$$$J$+$Ce(B
e$B$?3&LL$,H/@8$7!"[email protected]$,LdBj$K$J$C$F$$$k$h$&$K8+$($^$9!#e(B

e$B$3$3$^$G$Ge(BUnifye$B$r;D$9$Y$-M}[email protected]$5$s$,=R$Y$i$l$?$b$Ne(B
e$B$O!"!Ve(Bfreezee$B;[email protected]$Ge(Bmathne$B$,F0$+$J$$!W$H$$$&[email protected]$H;W$$$^$9$,!“e(B
[email protected]$7$$$G$9$+!)e(B [email protected]$7!”:G=Ee(B
e$B$K$O$=$&[email protected]$,!“e(B9/25(e$B$b$&2a$.$A$c$$$^$7$?$Me(B)e$B$K$O$H$Fe(B
e$B$b4V$K9g$o$J$$!”$H!#e(B

Yuguie$B$5$s$K$O$3$l$+$iAjCL$7$^$9$,!"$=$l$Oe(Brational, complex,
mathne$B4V$N3&LL$NLdBj$J$N$G!":#[email protected][email protected]$$$F!“e(B(10/25
e$B$/$i$$$^$G$+$1$Fe(B)e$B>-MhE*$K$”$k$Y$-;Q$K$^$H$a$F$$$/$,NI$$$N$G$Oe(B
e$B$J$$$+$H;W$$$^$9!#e(B

e$B$H$j$"$($:8=;[email protected]$G$O$U$J$P$5$s$r%a%s%F%[email protected]$/$3e(B
e$B$H$O9M$($F$$$^$;$s!#e(B

|e$B>>K$5$s$OCN$C$F$$$k$H;W$$$^$9$,e(B, e$B:#=5$O5Y2KCf$G$9$N$G$"$^$jH?1~$O$G$-e(B
|e$B$J$$$H$*$b$$$^$9e(B.

e$B>e5-$N0U8+$O!"!VC1$K;~4V$NLdBj$G$O$J$$$+!W$H$$$&;d$N?dB,$K4pe(B
e$B$E$$$F$$$^$9$N$G!"$=$l$,4V0c$C$F$$$k$J$i$P!"$^[email protected]$K$Je(B
e$B$k$H;W$$$^$9!#e(BYuguie$B$5$s$H$OAjCL$7$F$*$-$^$9$N$G!"!Ve(Bratinal,
complexe$B$O:#8e$be(Bmathne$B$rFCJL07$$$9$Y$-M}M3!W$K$D$$$FJdB-$,$"$je(B
e$B$^$7$?$i!"5Y2K8e$K$G$b65$($F$/[email protected]$5$$!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36611 ] the message: "[ruby-dev:36611] Re:
{Complex,Rational}::Unify ", on Sep/27 12:36(JST) Yukihiro M.
writes:

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

e$B;d$K$Oe(Bcomplex,rational,mathne$B$G0lBN$G$"$C$?$b$N$,!":#2sA0Fs<Te(B
[email protected]$1$U$J$P$5$s$,%a%s%F%J$K$J$C$?$?$a!":#$^$G30$K=P$F$$$J$+$Ce(B
e$B$?3&LL$,H/@8$7!"[email protected]$,LdBj$K$J$C$F$$$k$h$&$K8+$($^$9!#e(B

e$B3N$Ke(B.

e$B$3$3$^$G$Ge(BUnifye$B$r;D$9$Y$-M}[email protected]$5$s$,=R$Y$i$l$?$b$Ne(B
e$B$O!"!Ve(Bfreezee$B;[email protected]$Ge(Bmathne$B$,F0$+$J$$!W$H$$$&[email protected]$H;W$$$^$9$,!“e(B
[email protected]$7$$$G$9$+!)e(B [email protected]$7!”:G=Ee(B
e$B$K$O$=$&[email protected]$,!“e(B9/25(e$B$b$&2a$.$A$c$$$^$7$?$Me(B)e$B$K$O$H$Fe(B
e$B$b4V$K9g$o$J$$!”$H!#e(B

e$B$=$&$G$9e(B.

Yuguie$B$5$s$K$O$3$l$+$iAjCL$7$^$9$,!"$=$l$Oe(Brational, complex,
mathne$B4V$N3&LL$NLdBj$J$N$G!":#[email protected][email protected]$$$F!“e(B(10/25
e$B$/$i$$$^$G$+$1$Fe(B)e$B>-MhE*$K$”$k$Y$-;Q$K$^$H$a$F$$$/$,NI$$$N$G$Oe(B
e$B$J$$$+$H;W$$$^$9!#e(B

e$B>-MhE*$K$"$k$Y$-;Q$G$9$Me(B. e$BN;2r$G$9e(B.

e$B$H$j$"$($:8=;[email protected]$G$O$U$J$P$5$s$r%a%s%F%[email protected]$/$3e(B
e$B$H$O9M$($F$$$^$;$s!#e(B

e$BN;2r$G$9e(B. e$BFC$K$3$N7o$K$D$$$F94$k$D$b$j$O$J$$$G$9e(B.

e$B>e5-$N0U8+$O!"!VC1$K;~4V$NLdBj$G$O$J$$$+!W$H$$$&;d$N?dB,$K4pe(B
e$B$E$$$F$$$^$9$N$G!"$=$l$,4V0c$C$F$$$k$J$i$P!"$^[email protected]$K$Je(B
e$B$k$H;W$$$^$9!#e(BYuguie$B$5$s$H$OAjCL$7$F$*$-$^$9$N$G!"!Ve(Bratinal,
complexe$B$O:#8e$be(Bmathne$B$rFCJL07$$$9$Y$-M}M3!W$K$D$$$FJdB-$,$"$je(B
e$B$^$7$?$i!"5Y2K8e$K$G$b65$($F$/[email protected]$5$$!#e(B

e$B2r7h$G$-$k$^$G$N;~4V$NLdBj$,$^$:$"$j$^$9e(B.

e$B$=$l$He(B, e$B$=$N4Ve(B, mathn
e$B$,[email protected]$,Hs>o$K5$$K$J$C$F$$$^$9e(B. e$B$=$l$3$=e(B
freeze
e$B$5$l$F$$$k$O$:$J$N$KF0:n$7$J$$$N$O$"$^$jNI$$>uBV$G$O$J$$$H9M$(e(B
e$B$^$9e(B. e$B$=$l$Ge(B, e$B$U$J$P$5$s$K$Oe(B,
e$BM1M=4|8B$b$7$/$O?7$7$$e(Bmathne$B$,=PMh$k$^$Ge(B
e$B$N4Ve(B, raional.c/complex.c e$B$Oe(B Unify
e$B$,$"$k>[email protected]$-$?$$$G$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$=$l$G!"KM$,[email protected]$&$^$G$b$J$$$3$H$G$9$,!"e(Bmathn [email protected]$5$s$NC4Ev$J$Ne(B
e$B$G!"I,MW$J$iD>$9$J$j!“La$9$J$j!”$9$l$P$$$$$H;W$$$^$9!#e(B

e$B$3$l$O$3$l$Ge(B, e$BF0:n$7$F$$$^$9$N$Ge(B, e$B<h$j$"$($:$O$3$l$G$$$$$G$9e(B.

e$B$G$O!";C$/$O$3$l$G$$$$$H$7$F!"$f$C$/$j$He(B 2.0
e$B$^$G$NCf4|E*$JBP:v$K$D$$$Fe(B
e$B9M$($^$7$g$&!#e(B

mathn e$B$GBP1~$G$-$J$$$J$iB>$K9M$($b$"$k!"$H$$$&$3$H$b0U<1E*[email protected]$Ce(B
e$B$F$$$^$9e(B.

e$B$H$N$3$H$G$7$?$,e(B, e$B$I$N$h$&$J9M$($G$7$g$&$+e(B?

e$B$=$l$K$D$$$FEz$($h$&$H;W$C$?$N$G$9$,!"$=$l$,I,MW$JM}M3$+$iOC$7$F$b$i$(e(B
e$B$^$9$+!#$I$&BP1~$G$-$J$$$N$+!#8@MU$NLdBj$O$H$b$+$/!“LLE][email protected]!”[email protected]$oe(B
e$B$l$F$J$$$H;W$$$^$9!#e(B

e$B:G=i$+$ie(B mathn
e$B$K$OFCJL$JG[N8$,I,[email protected]!"$H$NA0Ds$GOC$5$l$F$$$k$h$&$K8+$(e(B
e$B$F$7$^$$$^$9!#$=$&$G$"$l$P!"$=$b$=$b$3$NOC$r$7$?0UL#$,$J$$$H;W$$$^$9!#e(B

[email protected]$5$s$NCf$G$=$&$$$&[email protected]$,=P$F$$$k$N$+$b$7$l$^$;$s$,!“KM$K$OH=$i$J$$e(B
e$B$s$G$9!#2[email protected]$$$^$9$,!”$=$N$"$?$j$+$i!"[email protected]$,$*$+$7$/$J$C$F$$$k$N$G!"e(B
e$B$=$3$OHt$;$J$$$H;W$$$^$9!#e(B

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

e$B8D?ME*$K2qOC$7$F$$$^$7$?e(B.

In the message: "[ruby-dev:36614] Re: {Complex,Rational}::Unify ", on
Oct/01 21:21(JST) Tadayoshi F. writes:

e$B$o$?$7$be(B, e$BNc$NH/[email protected]$O8m2r$K$b$H$E$/$b$N$G$"$je(B, e$B$=$NH/[email protected]$OE12s$5$;$F$$$?e(B
[email protected]$$$H$*$b$$$^$9e(B.

e$B$o$+$j$^$7$?!#e(B

e$BESCf$N$d$j<h$j$O>JN,$5$;[email protected]$-$^$9$,e(B,

e$BNc$NH/[email protected]$O8m2r$K$b$H$E$/$b$N$G$"$je(B,
e$B$=$NH/[email protected]$OE12s$5$;[email protected]$-$?$$$He(B
e$B;W$$$^$9e(B.

e$B$U$J$P$5$s$r$O$8$ae(B, e$B$^$D$b$H$5$se(B, e$B$_$J$5$^e(B,
e$B$*A{$,$7$;$F?=$7Lu$"$j$^$;e(B
e$B$s$G$7$?e(B.

e$B$=$l$G!"KM$,[email protected]$&$^$G$b$J$$$3$H$G$9$,!"e(Bmathn [email protected]$5$s$NC4Ev$J$Ne(B
e$B$G!"I,MW$J$iD>$9$J$j!“La$9$J$j!”$9$l$P$$$$$H;W$$$^$9!#e(B

e$B$3$l$O$3$l$Ge(B, e$BF0:n$7$F$$$^$9$N$Ge(B,
e$B<h$j$"$($:$O$3$l$G$$$$$G$9e(B.

e$BB>$K2?$+$"$l$P!"$=$N5$;}$r;}$C$Fe(B ruby-dev [email protected]<$r$+$1$F$b$i$($P!"e(B
e$BKM$b$A$c$s$HOC$K1~$8$^$9$N$G!#e(B

e$B$=$l$Ge(B,

mathn e$B$GBP1~$G$-$J$$$J$iB>$K9M$($b$"$k!"$H$$$&$3$H$b0U<1E*[email protected]$Ce(B
e$B$F$$$^$9e(B.

e$B$H$N$3$H$G$7$?$,e(B, e$B$I$N$h$&$J9M$($G$7$g$&$+e(B?

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36654 ] the message: "[ruby-dev:36654] Re:
{Complex,Rational}::Unify ", on Oct/02 20:12(JST) Tadayoshi F.
writes:

e$B$G$O!";C$/$O$3$l$G$$$$$H$7$F!"$f$C$/$j$He(B 2.0 e$B$^$G$NCf4|E*$JBP:v$K$D$$$Fe(B
e$B9M$($^$7$g$&!#e(B

e$B>>K$5$s$,8r>D$7$F$/[email protected]$C$F$$$k$N$Ge(B, e$B$G$-$l$Pe(B,
e$B:#2s$N$K>h$C$+$k$He(B
e$B$&$l$7$$$N$G$9$,e(B. e$B$b$A$m$se(B,
e$B$"$^$j;~4V$,$J$$$N$GBg3]$+$j$J$3$H$O$G$-$Je(B
e$B$/$J$k$H;W$$$^$9$,e(B…

[email protected]$5$s$NCf$G$=$&$$$&[email protected]$,=P$F$$$k$N$+$b$7$l$^$;$s$,!“KM$K$OH=$i$J$$e(B
e$B$s$G$9!#2[email protected]$$$^$9$,!”$=$N$"$?$j$+$i!"[email protected]$,$*$+$7$/$J$C$F$$$k$N$G!"e(B
e$B$=$3$OHt$;$J$$$H;W$$$^$9!#e(B

e$BN;2re(B. e$B$=$l$b$=$&$G$9e(B.

[email protected](B, [email protected]>[email protected]$C$FI,[email protected]$+$i$G$O$J$/$Fe(B,
e$B;d$NL\[email protected]+$+$iMh$F$$$^$9e(B.

e$B$^$:e(B, e$BIaDL$Ke(B mathn
e$B$,;H$o$l$k$h$&$K$J$C$FM_$7$$$H$$$&;W$$$,$"$j$^e(B
e$B$9e(B. [email protected]$&$^$G$b$J$$$3$H$G$9$,e(B, mathne$B$H$$$&$N$Oe(B, exact
number e$B4V$N0\F0$re(B
e$B<+M3$K$9$k$N$,L\E*$G$9e(B. e$B:#$G$be(B,
Rubye$B$Oe(BFixnume$B$He(BBignume$B$G9T$o$l$F$$$^$9$,e(B,
e$B$=$l$N3HD%$G$9e(B.

e$B$G$Oe(B, e$B8=9T$O$I$&$J$C$F$$$k$+$H$$$&$He(B,
Rationale$B$OAH$9~$$K$J$j$^$7$?$,e(B,
[email protected]?tF1;N$N3d$j;;$Ge(BRationale$B$,@8@.$5$l$k$o$1$G$J$$$N$Ge(B,
Rationale$B$r;H$$$?e(B
e$B$1$l$Pe(B, [email protected]<(=PMh$Ke(B

Rational(1)/Rational(2)

e$B$H$+$7$J$/$F$O$J$i$:e(B, e$B8=9T$N$^$^$G$Oe(B Rational
e$B$N2ACM$O%$%^%$%A$Ge(B,
mathne$B$,$"$C$F2ACM$,H/4x$G$-$k$H;W$$$^$9e(B.

e$B>u67$Oe(B, floate$B$bF1$8$G$9$,e(B, [email protected]$N%j%F%i%k$,$"$ke(B.

[email protected](B, [email protected]$&$He(B, mathne$B$Oe(B,
e$B3d$j;;$N?6$kIq$$$,4{B8$N?6$kIq$$$H0c$C$F$$e(B
e$B$^$9e(B. e$B7W;;>e$3$C$A$N?6$kIq$$$,NI$$$H;W$C$F$$$^$9$,e(B,
e$B4{B8$N%i%$%V%i%j$,e(B
e$BF0:n$9$k$H$O8B$i$J$$$G$9e(B(to_inte$B$N$*[email protected]$$$VF0$-$=$&$G$9$,e(B).
e$B$Ge(B,
mathne$B$,$b$C$HIa5Z$9$l$Pe(B, e$BF0$+$J$$%i%$%V%i%j$,$G$?>l9g$G$be(B,
mathne$B$GF0$+e(B
e$B$J$$$N$Ge(B, e$B$=$N%i%$%V%i%[email protected]$7$F$/[email protected]$5$$$He(B,
[email protected]$($k$0$i$$$^$G9-e(B
e$B$^$C$FM_$7$$$s$G$9$Me(B.

e$B$=$l$He(B, e$B:#8ee(B, Rubye$B$N$[$&$G$Oe(B, int/int
e$B$r$I$&$9$k$+$NOC$,=P$F$/$k$H;W$$e(B
e$B$^$9$,e(B, e$B$=$NA*Br;h$N0l$D$K$J$C$FM_$7$$$s$G$9$Me(B.

e$B$=$N$?$a$K$be(B,
e$B3HD%%i%$%V%i%j$0$i$$$N%Q%U%)!<%^%s%9$,M_$7$$$H;W$C$F$$$ke(B
e$B$o$1$G$9e(B.

1.9.1e$B$Ge(Bmathne$B$,9b%Q%U%)!<%^%s%9$GF3F~$5$le(B,
2.0e$B$GI8=`$N?6$kIq$$$K$^$G;}$Ce(B
e$B$F$$$/$N$,e(B, e$B;d$N4jK>$G$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

[email protected](B, [email protected]>[email protected]$C$FI,[email protected]$+$i$G$O$J$/$Fe(B, e$B;d$NL\[email protected]+$+$iMh$F$$$^$9e(B.

e$B$^$:e(B, e$BIaDL$Ke(B mathn e$B$,;H$o$l$k$h$&$K$J$C$FM_$7$$$H$$$&;W$$$,$"$j$^e(B
e$B$9e(B. [email protected]$&$^$G$b$J$$$3$H$G$9$,e(B, mathne$B$H$$$&$N$Oe(B, exact number e$B4V$N0\F0$re(B
e$B<+M3$K$9$k$N$,L\E*$G$9e(B. e$B:#$G$be(B, Rubye$B$Oe(BFixnume$B$He(BBignume$B$G9T$o$l$F$$$^$9$,e(B,
e$B$=$l$N3HD%$G$9e(B.

e$B$s!<!"$J$+$J$+87$7$s$8$c$J$$$+$H!#e(B

[email protected](B, [email protected]$&$He(B, mathne$B$Oe(B, e$B3d$j;;$N?6$kIq$$$,4{B8$N?6$kIq$$$H0c$C$F$$e(B
e$B$^$9e(B. e$B7W;;>e$3$C$A$N?6$kIq$$$,NI$$$H;W$C$F$$$^$9$,e(B, e$B4{B8$N%i%$%V%i%j$,e(B
e$BF0:n$9$k$H$O8B$i$J$$$G$9e(B(to_inte$B$N$*[email protected]$$$VF0$-$=$&$G$9$,e(B). e$B$Ge(B,
mathne$B$,$b$C$HIa5Z$9$l$Pe(B, e$BF0$+$J$$%i%$%V%i%j$,$G$?>l9g$G$be(B, mathne$B$GF0$+e(B
e$B$J$$$N$Ge(B, e$B$=$N%i%$%V%i%[email protected]$7$F$/[email protected]$5$$$He(B, [email protected]$($k$0$i$$$^$G9-e(B
e$B$^$C$FM_$7$$$s$G$9$Me(B.

e$B$$$o$l$k$3$H$O$$$/$i$+M}2r$G$-$^$9$,!“Ia5Z$9$k$N$b!”$=$N%i%$%V%i%j$r=$e(B
[email protected]$7$F$/[email protected]$5$$!"$H$$$&$N$b$=$s$J$K4JC1$K$O$$$+$J$$$G$9$h$M!#e(B

e$B<B:]$K$$$/$D$+$N%i%$%V%i%j$r!“e(Bmathn
e$B$G$bF0$/$h$&Cm0U$7$F<BAu$7$?7P83$+e(B
e$B$i$$$&$H0lHL$N?M$K!“e(Bmathn
e$B$”$j$J$7$G$A$c$s$HF0$/$h$&$K$7$m!”$H$$$&$N$Oe(B
e$B8=<BE*$8$c$J$$$G$9$M!#e(Bruby e$BK\Mh$N?tCM7O$N2]Bj$HL7=b$H!“e(Bmathn
e$B$N2]Bj$HL7e(B
e$B=b$NN>J}$rJz$($k;v$K$J$j$^$9!#$?$V$s!”$&$s$6$j$7$^$9!#e(B

e$B$I$s$J$K$,$s$P$C$F$b!"e(Bmathn e$B$,K\Mh$Ne(B ruby
e$B$H$O0c$&$b$N$rDs6!$7$F$$$k0Je(B
e$B>e!"E,MQHO0O$OHs>o$K8B$i$l$^$9$h$M!#e(Bmathn
[email protected]$H;W$$$^$9!#@5D>!“B>e(B
e$B$N$H$3$m$KCmJ8$D$1$k0JA0$NLdBj$C$F$N$,$”$k$H;W$$$^$9!#e(B

e$B$=$l$He(B, e$B:#8ee(B, Rubye$B$N$[$&$G$Oe(B, int/int e$B$r$I$&$9$k$+$NOC$,=P$F$/$k$H;W$$e(B
e$B$^$9$,e(B, e$B$=$NA*Br;h$N0l$D$K$J$C$FM_$7$$$s$G$9$Me(B.

e$B$=$N$?$a$K$be(B, e$B3HD%%i%$%V%i%j$0$i$$$N%Q%U%)!<%^%s%9$,M_$7$$$H;W$C$F$$$ke(B
e$B$o$1$G$9e(B.

1.9.1e$B$Ge(Bmathne$B$,9b%Q%U%)!<%^%s%9$GF3F~$5$le(B, 2.0e$B$GI8=`$N?6$kIq$$$K$^$G;}$Ce(B
e$B$F$$$/$N$,e(B, e$B;d$N4jK>$G$9e(B.

e$B$[$H$s$Ie(B mathn e$B$NOC$8$c$J$/$F!“e(Bruby
e$B$K$=$&$$$&5!G=$rF~$l$h$&!”$H$$$&OCe(B
[email protected]$H;W$$$^$9$,!“KM$Oe(B mathn e$B$,e(B mathn
e$B$H$7$F$”$k8B$j$O!"$=$&$$$&OC$H7k$Se(B
e$B$D$1$F$b$7$g$&$,$J$$$+$J$H;W$C$F$$$^$9!#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