e$B86$G$9!#e(B
e$B$U$J$P$G$9!#e(B
e$B86$5$s$Ne(B rational 1.12 e$B$G!"$D$.$N$h$&$K%(%i!<$K$J$j$^$9!#e(B
$ ruby -v -r rational -e ‘p “13.0/4”.to_r’
ruby 1.8.4 (2005-12-24) [i386-freebsd5.4]
-e:1:in `to_r’: Error of Implementation (rb_rat_eval_str). (fatal)
from -e:1
e$B$&$&!"$3$l$+$i$O!“e(B"13.0/4”.to_r e$B$Oe(B “13.0”.to_r
e$B$H2r<a$9$k$3$H$K$7$^$9!#e(B
e$B;X?tI=8=$G2r<a$r4V0c$($^$9!#e(B
‘9e0’.to_r #=> 9/1
‘-9e0’.to_r #=> 9/1
e$B%_%9$G$7$?!#e(B
e$B%9%i%C%7%e$,$i$_$GHyL/$J2r<a$r$7$^$9!#e(B
‘9/’.to_r # ZeroDivisionError
‘9/’.to_r e$B$Oe(B ‘9’.to_r e$B$H$$$&2r<a$r$9$Y$-$G$7$?!#e(B
e$B>[email protected]$G=*$k$H%(%i!<$K$J$j$^$9!#e(B
Float(‘9.’) #=> 9.0
Rational(‘9.’) # ArgumentError
e$B$3$l$O%(%i!<$K$9$k$3$H$K$J$C$?$N$G$9$M!#e(B
e$BJ8;zNs$N2r<a$N%k!<%F%#%s$re(Brubye$BK\BN$N$H6&MQ$7$h$&$H$$$&e(B
e$BLnK>$O<N$F$FFH<+O)@~$G9T$/$3$H$K$7$^$7$?!#e(B
e$B8=>ue(B(rational-1.13)e$B$O$3$&$J$C$F$$$^$9e(B:
“”.to_r => 0 Rational("") => ArgumentError
“+7 7”.to_r => 7 Rational("+7 7") => ArgumentError
“+7_”.to_r => 7 Rational("+7_") => ArgumentError
“+7".to_r => 0 Rational("+7") => ArgumentError
“-7 7”.to_r => -7 Rational("-7 7") => ArgumentError
"7".to_r => 7 Rational("7”) => ArgumentError
“7_7”.to_r => 77 Rational(“7_7”) => 77
“".to_r => 0 Rational("”) => ArgumentError
“+7".to_r => 0 Rational("+7”) => ArgumentError
“_7”.to_r => 0 Rational("_7") => ArgumentError
“+7E 1”.to_r => 7 Rational("+7E 1") => ArgumentError
“+7E1”.to_r => 70 Rational("+7E1") => 70
“+7_7.7_7E-0_1”.to_r => 7777/1000 Rational("+7_7.7_7E-0_1") =>
7777/1000
“- 7.7”.to_r => -77/10 Rational("- 7.7") => -77/10
“-7.7”.to_r => -77/10 Rational("-7.7") => -77/10
“-7.7E-2”.to_r => -77/1000 Rational("-7.7E-2") => -77/1000
“-7.7E_1”.to_r => -77/10 Rational("-7.7E_1") => ArgumentError
“-7E+1".to_r => -7 Rational("-7E+1") => ArgumentError
"-7E-1".to_r => -7/10 Rational("-7E-1”) => ArgumentError
“-7E1”.to_r => -70 Rational("-7E1") => -70
“-7E1_”.to_r => -70 Rational("-7E1_") => ArgumentError
“-7E_1”.to_r => -7 Rational("-7E_1") => ArgumentError
“-7_7.7_”.to_r => -777/10 Rational("-7_7.7_") => ArgumentError
“.”.to_r => 0 Rational(".") => ArgumentError
“.7”.to_r => 7/10 Rational(".7") => 7/10
“0.7”.to_r => 7/10 Rational(“0.7”) => 7/10
“7.”.to_r => 7 Rational(“7.”) => ArgumentError
“7.1E_1”.to_r => 71/10 Rational(“7.1E_1”) => ArgumentError
“7.7”.to_r => 77/10 Rational(“7.7”) => 77/10
“7.7/3”.to_r => 77/10 Rational(“7.7/3”) => ArgumentError
“7.7E-2”.to_r => 77/1000 Rational(“7.7E-2”) => 77/1000
“7.7_”.to_r => 77/10 Rational(“7.7_”) => ArgumentError
“7.E_1”.to_r => 7 Rational(“7.E_1”) => ArgumentError
“7.".to_r => 7 Rational("7.”) => ArgumentError
“7.7".to_r => 7 Rational("7.7") => ArgumentError
“7.E1".to_r => 7 Rational(“7.E1") => ArgumentError
“7.E_1".to_r => 7 Rational(“7.E_1") => ArgumentError
"77.7”.to_r => 777/10 Rational("77.7”) => ArgumentError
“7E”.to_r => 7 Rational(“7E”) => ArgumentError
“7E+1".to_r => 7 Rational(“7E+1") => ArgumentError
“7E-1”.to_r => 7/10 Rational(“7E-1”) => 7/10
“7E0”.to_r => 7 Rational(“7E0”) => 7
“7E1”.to_r => 70 Rational(“7E1”) => 70
"7E1”.to_r => 70 Rational("7E1”) => ArgumentError
“7E_1”.to_r => 7 Rational(“7E_1”) => ArgumentError
"7.”.to_r => 7 Rational("7.”) => ArgumentError
"7.7”.to_r => 7 Rational(“7_.7_”) => ArgumentError
“7_.7".to_r => 7 Rational("7.7") => ArgumentError
“7_E+1”.to_r => 7 Rational(“7_E+1”) => ArgumentError
“7_E1”.to_r => 7 Rational(“7_E1”) => ArgumentError
“7_E_1”.to_r => 7 Rational(“7_E_1”) => ArgumentError
“E1”.to_r => 0 Rational(“E1”) => ArgumentError
".7”.to_r => 0 Rational(".7") => ArgumentError
".7".to_r => 0 Rational("._7") => ArgumentError
“_7.”.to_r => 0 Rational("_7.") => ArgumentError
“-7 / 3_”.to_r => -7/3 Rational("-7 / 3_") => ArgumentError
“-7/”.to_r => -7 Rational("-7/") => ArgumentError
“-7/-3_”.to_r => 7/3 Rational("-7/-3_") => ArgumentError
“-7/3_”.to_r => -7/3 Rational("-7/3_") => ArgumentError
“7 / - 3”.to_r => -7/3 Rational(“7 / - 3”) => -7/3
“7 / 3”.to_r => 7/3 Rational(“7 / 3”) => 7/3
“7 / 3_”.to_r => 7/3 Rational(“7 / 3_”) => ArgumentError
“7/”.to_r => 7 Rational(“7/”) => ArgumentError
“7/-3_”.to_r => -7/3 Rational(“7/-3_”) => ArgumentError
“7/3_”.to_r => 7/3 Rational(“7/3_”) => ArgumentError
e$B5!3#E*$KLVMe$7$h$&$H$7$?$1$I!"$J$+$J$+Fq$7$/$F;[email protected]$1!#e(B