Complex & Rational

1.9 (1.9.1 e$B$K8~$1$Fe(B) e$B$G!"e(BComplexe$B!"e(BRational
e$B$K$D$$$F<c43$NJQ99$r$7$?$$$He(B
e$B;W$$$^$9!#e(B

Complex#/ e$B$N?6Iq$$$re(B quo e$BAjEv$K$7$^$9!#e(B

e$B0JA0$N5DO@$G!“35$M9g0U$G$-$F$$$?$H;W$$$^$9!#$3$N7kO@$NA0Ds$H$7$F!“e(B
Integer#/
e$B$b4^$a$F$=$N$h$&$K?6$kIq$&$N$,K>$^$7$/!“6a$$>-Mh!”$=$N$h$&e(B
e$B$KJQ99$5$l$k$3$H$,4|BT$5$l$k!”$H$$$&$3$H$,$”$j$^$9!#e(B

Complex.generic? e$B$r:o=|$7$^$9!#e(B

e$B308~$1$K$O$"$^$j0UL#$,$J$$$7!"$`$7$mM-32$G$O$J$$$+$H;W$$$^$9!#e(B

{Complex,Rational}#inspect e$B$N=q<0$rJQ99$7$?$$!#e(B

e$BM}M3$O!“B>$NAH$$3$$N?tCM%/%i%9$H0c$$$,:]N)$C$F$$$k$7!”?sD%$k$+$i$Ge(B
e$B$9!#e(Bto_s e$B$HF1$8$+!"$"$k$$$Oe(B “(1+2i)” e$B$de(B “(1/2)”
e$B$N$h$&$K3g8L$G3g$k$@e(B
e$B$1$G$b$$$$$N$G$O!"$H;W$$$^$9!#e(B

e$B$=$NB>!"$d$C$Q$j!"e(BCMath e$B$r$J$/$7$F!"e(BMath
e$B$KE}0l$9$k$H$+!"e(BComplexe$B!“e(B
Rational e$B$H$OD>@\4X78$”$j$^$;$s$,!"0JA0$N5DO@$G=P$F$$$?e(B scalar?
e$B$O$d$ae(B
e$B$?$[$&$,$$$$$N$G$O$J$$$+e(B? e$B$H$$$&OCe(B ( e$BBe$j$Ke(B real?
e$B$rF3F~e(B) e$B$O$^$?$$$:$le(B
e$B$7$?$$$H;W$$$^$9!#e(B

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

In [ruby-dev :35866 ] the message: "[ruby-dev:35866] Complex &
Rational ", on Aug/17 20:45(JST) Tadayoshi F. writes:

Complex#/ e$B$N?6Iq$$$re(B quo e$BAjEv$K$7$^$9!#e(B
e$B0JA0$N5DO@$G!“35$M9g0U$G$-$F$$$?$H;W$$$^$9!#$3$N7kO@$NA0Ds$H$7$F!“e(B
Integer#/ e$B$b4^$a$F$=$N$h$&$K?6$kIq$&$N$,K>$^$7$/!“6a$$>-Mh!”$=$N$h$&e(B
e$B$KJQ99$5$l$k$3$H$,4|BT$5$l$k!”$H$$$&$3$H$,$”$j$^$9!#e(B

Rationale$B$OAH$9~$$K$J$k$s$@$7$h$$$s$8$c$J$$$G$7$g$&$+e(B?

Complex.generic? e$B$r:o=|$7$^$9!#e(B
e$B308~$1$K$O$"$^$j0UL#$,$J$$$7!"$`$7$mM-32$G$O$J$$$+$H;W$$$^$9!#e(B

e$B$3$l$C$Fe(B, e$B308~$1$G$O$J$/e(B,
e$BFbIt$G1i;;$9$k$?$a$N$b$N$G$9$,e(B…
e$B$Ge(B, e$B$3$l$N85!9$N0U?^$G$9$,e(B…

Rubye$B$Ne(Bcoercee$B%a%+%K%:%`$Oe(B,
e$B<+J,$N$7$J$i$$%/%i%9$N1i;;$O$=$C$A$K$d$C$F$be(B
e$B$i$&$H$$$&$b$N$G$9e(B. Complexe$B$N>l9g$Oe(B,
e$B<+J,$NCN$i$J$$%/%i%9$G$b7W;;$G$-e(B
e$B$k>l9g$,$"$k$o$1$G$9$Me(B. e$B$D$^$je(B,
e$BAj<j$,<B?t$N%5%V%;%C%H$N>l9g$G$9e(B.

e$B$G$9$N$Ge(B, e$B$3$N9M$($,0];}$5$l$k$J$ie(B,
e$BB>$N$b$N$K$J$C$F$b$+$^$$$^$;$se(B.
e$BNc$($Pe(B, e$B8e$G$G=P$F$/$ke(B, scalar?(e$B$H$+e(Breal?)
e$B$G$b<B8=2DG=$G$9$Me(B.

{Complex,Rational}#inspect e$B$N=q<0$rJQ99$7$?$$!#e(B

e$BM}M3$O!“B>$NAH$$3$$N?tCM%/%i%9$H0c$$$,:]N)$C$F$$$k$7!”?sD%$k$+$i$Ge(B
e$B$9!#e(Bto_s e$B$HF1$8$+!"$"$k$$$Oe(B “(1+2i)” e$B$de(B “(1/2)” e$B$N$h$&$K3g8L$G3g$k$@e(B
e$B$1$G$b$$$$$N$G$O!"$H;W$$$^$9!#e(B

inspecte$B$C$F$"$/$^$G$b%G%P%C%0$N$?$a$K$"$j$^$9$N$Ge(B,
e$B0lL$Ge(BComplexe$B$de(B
Rationale$B$N%$%s%9%?%s%9$@$J$HJ,$+$l$Oe(B,
e$B8=9T$N=q<0$K$3$@$o$k$D$b$j$O$J$$e(B
e$B$G$9e(B. e$B3F8D$G$/$/$k$N$O$h$$0F$+$be(B.

e$B$"$H$Oe(B, e$B%j%F%i%kF3F~$NOC$,=P$F$$$^$7$?$,e(B,
e$B$=$l$HF1$8=q<0$H$$$&$N$b$"$je(B
e$B$+$J$!e(B. e$B$G$be(B, e$B$3$NOC$OD9$/$J$j$=$&$J$N$Ge(B,
e$B<h$j$"$($:A0<T$Ge(B.

e$B$=$NB>!"$d$C$Q$j!"e(BCMath e$B$r$J$/$7$F!"e(BMath e$B$KE}0l$9$k$H$+!"e(BComplexe$B!“e(B
Rational e$B$H$OD>@\4X78$”$j$^$;$s$,!"0JA0$N5DO@$G=P$F$$$?e(B scalar? e$B$O$de(B
e$B$a$?$[$&$,$$$$$N$G$O$J$$$+e(B? e$B$H$$$&OCe(B ( e$BBe$j$Ke(B real? e$B$rF3F~e(B) e$B$O$^$?$$e(B
e$B$:$l$7$?$$$H;W$$$^$9!#e(B

e$B8eH>$OOC$O4JC1$@$H;W$$$^$9$,e(B, e$BA0H>$,$M$'e(B… e$B$^$?e(B,
e$B$$$:$l$H$$$&$3$H$Ge(B.

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

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

In the message: "[ruby-dev:35869] Re: Complex & Rational ", on Aug/19
00:22(JST) Tadayoshi F. writes:

ruby-dev e$B$K%a!<%k$,FO$+$J$$$N$G!“D>@$G$9$_$^$;$s$,!”$$$/$D$+3NG’$5$;$Fe(B
e$B$/$@$5$$!#e(B

e$B$U$J$P$5$s$N%F%9%H%a%$%k$OFO$$$F$$$?$_$?$$$G$9$,e(B…
e$B$H$j$"$($:e(B, ruby-dev e$B$K$be(BCce$B$rF~$l$F$"$j$^$9e(B.

e$B$G$9$N$Ge(B, e$B$3$N9M$($,0];}$5$l$k$J$ie(B, e$BB>$N$b$N$K$J$C$F$b$+$^$$$^$;$se(B.
e$BNc$($Pe(B, e$B8e$G$G=P$F$/$ke(B, scalar?(e$B$H$+e(Breal?) e$B$G$b<B8=2DG=$G$9$Me(B.

e$B0l1~8x3+$5$l$F$$$k$N$G!#$=$l$G!"<B:]$K$O!"e(Bgeneric? e$B$O!“e(BCMath (Math) e$B$Ne(B
e$B$”$?$j$G$7$+$D$+$o$l$*$i$:!"8@$o$l$k$h$&$K!"e(Bscalar? e$B$GCV$-49$($k$3$H$Ge(B
e$B$h$$$H;W$$$^$9!#e(B

e$B$3$N7o$K$7$F$Oe(B, e$B%O%$$J$s$G$9$,e(B…

generic?e$B$,;H$o$l$F$$$J$$$H$N$3$H$J$N$Ge(B…
e$B%=!<%9$r8+$k$He(B, e$B0J2<$N$h$&$K$J$C$F$$$^$9$,e(B,

static VALUE
nucomp_add(VALUE self, VALUE other)
{
switch (TYPE(other)) {
case T_FIXNUM:
case T_BIGNUM:
case T_FLOAT:
case T_RATIONAL:
{
get_dat1(self);

  return f_complex_new2(CLASS_OF(self),
      f_add(dat->real, other), dat->image);

}
case T_COMPLEX:
{
VALUE real, image;

  get_dat2(self, other);

  real = f_add(adat->real, bdat->real);
  image = f_add(adat->image, bdat->image);

  return f_complex_new2(CLASS_OF(self), real, image);

}
default:
return rb_num_coerce_bin(self, other, ‘+’);
}

e$B$3$&$G$J$/$Fe(B, T_FIXNUM, T_BIGNUM, T_FLOAT, T_RATIONAL
e$B$@$1$K$+$.$i$:e(B,
other e$B$,e(B real?(scalar?) e$B$@$C$?$ie(B,

  return f_complex_new2(CLASS_OF(self),
      f_add(dat->real, other), dat->image);

e$B$G$-$k$H8@$$$?$$$o$1$J$s$G$9$he(B.

{Complex,Rational}#inspect e$B$N=q<0$rJQ99$7$?$$!#e(B

e$BA0<T$H$$$&$3$H$O!"e(Bto_s e$B$HF1$8$G$h$$$H$$$&$3$H$G$9$+!#3NG’$7$?$$$N$G$9e(B
e$B$,!"e(B

e$B$$$(e(B, e$B3g8L$D$-$G$C$F$3$H$G$9e(B.
to_se$B$O:F5"E*$K8F$P$l$k$3$H$O$"$^$j$J$$$Ge(B
e$B$9$7e(B, e$B$"$C$F$be(B, e$B8F$S=P$9B&$,9M$($l$P$h$$$3$H$G$9$,e(B,
inspect e$B$O:F5"E*$Ke(B
e$B8F$P$l$k$N$,A0Ds$J$N$Ge(B,
e$B%*%V%8%’%/%H$N6-3&$OL@3N$K$J$C$FM_$7$$$G$9e(B.

Complex(3,1).to_s #=> “3+i”

e$B$N$h$&$J$3$H$b$"$jF@$k$G$7$g$&!#e(B

e$B$=$&$+e(B, e$B0l4S@-$,$J$+$C$?$s$G$9$Me(B…

e$B0l8+$7$F6hJL$9$k$?$a$K$O!“e(Bto_se$B!“e(Binspect e$B$H$b$K@55,2=$7$J$$$+!”$”$k$$$O!"e(B
e$B>/$J$/$H$be(B inspect e$B$G$O@55,2=$7$J$$$h$&$K$;$M$P$J$i$J$$$h$&$K;W$$$^$9!#e(B
e$B$I$A$i$,K>$^$7$$$G$7$g$&$+!#e(B

e$BN><T$H$b@55,2=$7$J$$J}$,$h$$5$$,$7$F$-$^$7$?e(B. to_se$B$Ge(B “1”
e$B$,JV$k$H@0?te(B
e$B$Ne(B1e$B$H4*0c$$$7$=$&$G$9$b$N$Me(B.

e$B$D$.$K!"e(B

Complex(Rational(1,3),Rational(1,3)).to_s #=> “1/3+(1/3)i”

e$B$H$J$C$F$$$k$N$G$9$,!"$?$H$($P!“e(BMIT Scheme e$B$J$I$$$/$D$+$Ne(B Scheme e$B=hM}7Oe(B
e$B$J$I$N7k2L$HHf$Y$F;W$&$N$O!“5uIt$,M-M}?t$N>l9g$N3g8L$OI,MW$J$N$+!”$H$$e(B
e$B$&$3$H$G$9!#e(Binspect e$B$N;v$r9M$($F$$$?$i!”$+$J$jHyL/$J46$8$K;W$($F$-$^$7e(B
e$B$?!#e(B

e$B$o$6$o$6$3$&$d$C$F$$$k$s$G$9$h$Me(B. 1/3i e$B$@$He(B 1/(3i)
e$B$K8+$($k$J$H;W$C$?e(B
e$B$s$G$9e(B. e$B$=$l$Ke(B,

(1/3)i e$B!be(B 1/(3i) e$B!ae(B -(1/3)i

e$B$G$9$7e(B… e$B$^$"e(B, e$B$?$@e(B, e$B$=$l$O?t<0$H$7$F$NOC$Ge(B,
Rubye$B>e$NI=5-$H$7$F$3$&$J$Ce(B
e$B$F$$$k$H$9$l$PLdBj$J$$5$$b$7$^$9e(B.
e$BB>$N=hM}7O$G0lHLE*$J$i$=$l$[$I$3$@$oe(B
e$B$j$^$;$se(B. – (A)

Complex(Rational(1,3),Rational(1,3)).to_s #=> “1/3+1/3i”
Complex(Rational(1,3),Rational(1,3)).inspect #=> “((1/3)+(1/3)i)”

e$B$H$$$&$o$1$K$O$$$+$J$$$G$7$g$&$+!#e(B

e$BI=8=E*$K$O0l4S@-$,$"$j$^$9$h$Me(B. e$B$"$H$Oe(B,
e$B>e5-e(B(A)e$B$NOC$@$1$G$9$,e(B, scheme
e$B0J30$C$F$I$&$J$C$F$$$k$s$G$7$g$&$+$Me(B…

scheme e$B$Oe(B 1/3+1/3i e$B$C$Fe(B atom
e$B$G85!93F8D$D$1$i$l$J$$$G$9$7e(B… e$B$3$&$G$"e(B
e$B$k$Y$-$H9M$($?$N$+e(B,
e$B$3$l$7$+I=8=$N$7$h$&$,$J$+$C$?$N$+H=CG$G$-$J$$$G$9e(B
e$B$7e(B…

mathematica e$B$Oe(B

1i

3

e$B8+$?$$$J46$8$G$9$Me(B. e$B$3$l$O$3$l$G$9$4!<$/G<F@$G$9$,e(B,
e$B$+$J$jFCJL07$$$7$Je(B
e$B$$$H$$$1$J$$$G$9$7$M$'e(B.

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

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

In [ruby-dev :35879 ] the message: "[ruby-dev:35879] Re: Complex &
Rational ", on Aug/19 20:03(JST) Tadayoshi F. writes:

e$B$3$&$G$J$/$Fe(B, T_FIXNUM, T_BIGNUM, T_FLOAT, T_RATIONAL e$B$@$1$K$+$.$i$:e(B,
other e$B$,e(B real?(scalar?) e$B$@$C$?$ie(B,
return f_complex_new2(CLASS_OF(self),
f_add(dat->real, other), dat->image);
e$B$G$-$k$H8@$$$?$$$o$1$J$s$G$9$he(B.
e$B$"$"!"$=$l$O$=$&$G$9!#e(B[ruby-dev:27877] e$B$G$b?($l$i$l$F$$$k$b$N$G$9$M!#e(B

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

e$BN><T$H$b@55,2=$7$J$$J}$,$h$$5$$,$7$F$-$^$7$?e(B. to_se$B$Ge(B “1” e$B$,JV$k$H@0?te(B
e$B$Ne(B1e$B$H4*0c$$$7$=$&$G$9$b$N$Me(B.
e$B$=$&$7$^$7$g$&$+!#e(B

e$B$O$$e(B.

Scheme e$B$N%j%F%i%k$H$7$F8+$l$P!“e(BScheme e$B$G$Oe(B i e$B$NA0$K$”$k$N$O!"<B?te(B (e$BM-M}e(B
e$B?t$b4^$`e(B) e$B$H$$$&$3$H$O!"e(BBNF e$B$G3NG’$G$-$^$9!#$3$l$r$_$?$H$3$m$G2r<a$KL5e(B
e$BM}$dIT<+A3$5$O46$8$^$;$s!#e(B

e$B$=$&$$$&0UL#$G$Oe(B, e$BIT<+A3$5$O$J$$$H;W$$$^$9$,e(B…

e$B$3$N7A<0$O!"@PDM$5$s$Ne(B Smalltalk e$B$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NsJQ49$r9T$C$F$$$k$3$H$,B?$$$N$Ge(B,
e$B3g8L$O$J$/$F$$$$$s$8$c$J$$$G$7$ge(B
e$B$&$+e(B.

scheme e$B$Oe(B 1/3+1/3i e$B$C$Fe(B atom e$B$G85!93F8D$D$1$i$l$J$$$G$9$7e(B… e$B$3$&$G$"e(B
e$B$k$Y$-$H9M$($?$N$+e(B, e$B$3$l$7$+I=8=$N$7$h$&$,$J$+$C$?$N$+H=CG$G$-$J$$$G$9e(B
e$B$7e(B…
e$B$R$H$D$N;z6g$G$9$,!“e(Bi e$B$NM%@hEY$ODc$$!”$H9M$($l$P$$$$$N$+$b!#e(B

e$B$3$N9M$($O$A$g$C$HL5M}$,$"$k$+$be(B(^^;;

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

e$B$I$&$b!#e(B

e$B9g0U$K1h$C$?=$@5$,$G$-$?$N$G$O$H;W$$$^$9!#e(B

e$B$D$$$G$K6K:BI87A<0$N2r<a$b$D$1$A$c$$$^$7$?!#e(B

Complex(‘1@1’) #=> (0.54030230586814+0.841470984807897i)

e$B$U$J$P$5$s$N%F%9%H%a%$%k$OFO$$$F$$$?$_$?$$$G$9$,e(B…
e$B$H$j$"$($:e(B, ruby-dev e$B$K$be(BCce$B$rF~$l$F$"$j$^$9e(B.

e$B:rF|e(B6e$BDLAw$C$F!"$"$l$@$1FO$$$?$h$&$G$9!#$3$l$bFO$/$N$+$I$&$+!#e(B

e$B$3$&$G$J$/$Fe(B, T_FIXNUM, T_BIGNUM, T_FLOAT, T_RATIONAL e$B$@$1$K$+$.$i$:e(B,
other e$B$,e(B real?(scalar?) e$B$@$C$?$ie(B,

  return f_complex_new2(CLASS_OF(self),
      f_add(dat->real, other), dat->image);

e$B$G$-$k$H8@$$$?$$$o$1$J$s$G$9$he(B.

e$B$"$"!"$=$l$O$=$&$G$9!#e(B[ruby-dev:27877]
e$B$G$b?($l$i$l$F$$$k$b$N$G$9$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9$,!"$3$l$^$G$N$H$3$m!"$3$N>l9g$N3g8L$OI,MW$@$H$O$$$($J$$$h$&$K;We(B
e$B$$$^$9!#e(B

e$B$D$1$k$J$i$D$1$k!"$D$1$J$$$J$i$D$1$J$$$G!"e(B

Complex(Rational(1,3),Rational(1,3)).to_s #=> “1/3+1/3i”
Complex(Rational(1,3),Rational(1,3)).inspect #=> “((1/3)+(1/3)i)”

e$B$H$$$&$o$1$K$O$$$+$J$$$G$7$g$&$+!#e(B

e$BI=8=E*$K$O0l4S@-$,$"$j$^$9$h$Me(B. e$B$"$H$Oe(B, e$B>e5-e(B(A)e$B$NOC$@$1$G$9$,e(B, scheme
e$B0J30$C$F$I$&$J$C$F$$$k$s$G$7$g$&$+$Me(B…

Scheme e$B0J30$@$H$"$^$j;W$$$D$+$J$$$G$9$M!#<j85$Ne(B Squeak
e$B$G$O!"e(B
“(1/3) + (1/3) i” e$B$C$F$J$j$^$7$?$1$I!#e(B

e$B@PDM$5$s$N$$$o$l$k$h$&$K!“e(Binspect
e$B$r:F5"E*$K$D$+$&!”$H$$$&$N$O!"$3$N>le(B
e$B9g$K$bEv$FVH$a$i$l$k$3$H$G!“e(BComplex
e$B$+$i$O!“I,MW0J>e$K$=$NFbMF$KF’$_9~e(B
e$B$^$:Cj>]E*$K$”$D$+$C$F$*$/$Y$-$@$H;W$&$7!”$=$&$9$k$H!">e$N$h$&$JI=8=$Ke(B
e$B$T$C$?$j$7$^$9$M!#e(B

scheme e$B$Oe(B 1/3+1/3i e$B$C$Fe(B atom e$B$G85!93F8D$D$1$i$l$J$$$G$9$7e(B… e$B$3$&$G$"e(B
e$B$k$Y$-$H9M$($?$N$+e(B, e$B$3$l$7$+I=8=$N$7$h$&$,$J$+$C$?$N$+H=CG$G$-$J$$$G$9e(B
e$B$7e(B…

e$B$R$H$D$N;z6g$G$9$,!“e(Bi e$B$NM%@hEY$ODc$$!”$H9M$($l$P$$$$$N$+$b!#e(B