e$B86$G$9!#e(B
Tadayoshi F. e$B$5$s$O=q$-$^$7$?e(B:
Rational() e$B$He(B Rational.new e$B$N0c$$$O!"e(BRational() e$B$OJQ494o$G!"e(B
Rational.new e$B$O4pACE*$J%3%s%9%H%i%/%?$H$$$&$3$H$@$H;W$$$^$9!#86$5$s$Ne(B
rational e$B$+$i$b$=$&$$$&0u>]$r<u$1$k$N$G!"4pK\E*$K9M$($F$$$k$3$H$OF1$8e(B
e$B$@$H;W$&$N$G$9$,!#e(B
e$BF1$8$G$9!#e(B
Rational e$B$rFbIt$G;H$&%i%$%V%i%j$G!“e(Bmathn.rb e$B$re(B include e$B$9$k$H!“Ez$($Oe(B
e$B@5$7$$$,!”=hM}B.EY$,$+$J$jCY$/$J$k$b$N$,$”$j$^$9!#$=$3$3$G!"e(BUnify e$B$N1Fe(B
e$B6A$r<u$1$J$$M-M}?t$N@8@.$,M_$7$$$H;W$C$?$N$G$9!#e(Be$B$7$+$7!“e(Bmathn e$B$9$k$HL5BL$JM-M}?t$rGS=|$9$k$3$H$K$J$k$N$G!”$"$k>lLL$G$Oe(B
e$BM-Mx$K$J$j$^$9$h$M!#AH$$3$$K$7$F!"?tCM7O$H$7$F$NO"7H$r6/2=$7!"%j%F%ie(B
e$B%k$rMQ0U$7$?$i!"$@$$$V0c$C$F$/$k$H;W$$$^$9!#e(B
e$B$J$k$[$I!#$+$($C$FAa$/$J$k$3$H$b$"$k$+!D!#$A$g$C$H<B83$7$F$_$^$9!#e(B
e$B$7$+$7!"e(BRational.new(1, 1) e$B$N7k2L$,e(B Rational e$B$G$J$/$F!“e(BInteger e$B$K$J$ke(B
e$B$N$O5$;}$A0-$$5$$,$7$^$;$s!)e(Bnew e$B$Oe(B private e$B$N$^$^$,$$$$$+$J$”!#e(Be$B$=$N463P$O$o$+$j$^$9$,!"$?$H$($P!"e(BCommon lisp e$B$G$O!"e(B1/1 e$B$O%j%F%i%k$G$9e(B
e$B$,!"e(B1 e$B$K$J$j$^$9!#J#AG?t$Ne(B #c(1 0) e$B$be(B 1 e$B$K$J$j$^$9!#e(Bnew e$B$K8GM-$N2]Bj$Ge(B
e$B$O$J$/!“e(BRational() e$B$de(B Rational.convert e$B$b!VJQ49!W$7$J$$$H$$$1$J$$$o$1e(B
e$B$G$9$+$i!“e(BInteger e$B$,JV$k$N$OJQ$G$”$k!”$H$$$($k$+$b$7$l$^$;$s!#e(B
Rational() e$B$O!VM-M}?t2=!W$J$N$G$$$$$s$G$9!#@0?t$OM-M}?t$@$+$i!#e(B
Rational.new e$B$Ne(B Rational e$B$O%/%i%9$@$+$i!“e(BInteger
e$B$rJV$5$l$k$H0cOB46$”$ke(B
e$B$s$G$9$h!#e(B
e$B$G$b!“B.$5$r5$$K$9$k%/%j%F%#%+%k$J%W%m%0%i%`$@$C$?$i$=$b$=$be(B mathn
e$B$r%$e(B
e$B%s%/%k!<%I$9$k$J!”$H$$$&$3$H$G$$$$$+$J!#e(B