# Rational 1.08

e\$B\$U\$J\$P\$G\$9!#e(B

Rational(2399550481, 480000000).to_f

e\$B\$H\$9\$k\$H%(%i!<\$K\$J\$j\$^\$9!#e(B

RangeError: bignum too big to convert into `long’

e\$B\$M\$P\$?\$G\$9!#e(B

e\$B:F8=\$7\$^\$;\$s!#e(B
e\$B\$A\$J\$_\$K!";d\$N4D6-\$G\$Oe(B
ruby 1.8.4 (2005-12-24) [i386-mswin32]
ruby 1.9.0 (2006-05-13) [i386-bccwin32]
e\$B\$H\$b\$K7k2L\$Oe(B
4.99906350208333
e\$B\$G\$7\$?!#e(B

versione\$B>pJs\$,\$J\$\$\$HEz\$(\$h\$&\$,\$J\$\$\$N\$G\$O!#e(B

e\$B\$U\$J\$P\$G\$9!#e(B

e\$B\$H\$/[email protected]\$H\$O;W\$(\$J\$+\$C\$?\$N\$G!"2?\$b=q\$-\$^\$;\$s\$G\$7\$?!#e(B

ruby 1.8.4 (2005-12-24) [i386-freebsd5.4]
r.rb:2:in `to_f': bignum too big to convert into`long’ (RangeError)
from r.rb:2

ruby 1.9.0 (2006-06-17) [i386-freebsd5.4]
r.rb:2:in `Rational#to_f': bignum too big to convert into`long’
(RangeError)
from r.rb:2

ruby 1.8.4 (2005-12-24) [i686-linux]
r.rb:2:in `to_f': bignum too big to convert into`long’ (RangeError)
from r.rb:2

ruby 1.8.4 (2005-12-24) [i386-solaris2.10]
r.rb:2:in `to_f': bignum too big to convert into`long’ (RangeError)
from r.rb:2

e\$B>e5-\$K2C\$(\$F!"e(Bcygwin
e\$B\$G\$bF1\$8\$G\$7\$?!#\$3\$l\$G\$h\$m\$7\$\$\$G\$7\$g\$&\$+e(B?

e\$B\$U\$J\$P\$G\$9!#e(B

ruby 1.8.4 (2005-12-24) [i386-mswin32]
ruby 1.9.0 (2006-05-13) [i386-bccwin32]

e\$B\$3\$N4D6-\$G\$Ne(B

require ‘rational’

fn = 0
p [fn.size, fn.class]
bn = (2**(fn.size*8)-1)
p [bn.size, bn.class]
r = bn.to_r
p r
f = r.to_f
p f

e\$B\$N<B9T7k2L\$r8+\$;\$F\$b\$i\$(\$^\$9\$+e(B?

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

e\$B\$U\$J\$P\$G\$9!#e(B

e\$B\$H\$/[email protected]\$H\$O;W\$(\$J\$+\$C\$?\$N\$G!"2?\$b=q\$-\$^\$;\$s\$G\$7\$?!#e(B

e\$B\$"\$"\$%!#\$9\$\$\$^\$;\$s!"\$3\$A\$i\$G\$b5/\$3\$j\$^\$7\$?!#e(B
e\$B:#F|Cf\$KBP=h\$7\$^\$9!#e(B

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

e\$B\$U\$J\$P\$G\$9!#e(B

Rational(2399550481, 480000000).to_f

e\$B\$H\$9\$k\$H%(%i!<\$K\$J\$j\$^\$9!#e(B

RangeError: bignum too big to convert into `long’

e\$B\$U\$J\$P\$5\$s!"\$\$\$D\$b\$"\$j\$,\$H\$&\$4\$6\$\$\$^\$9!#e(B

Integer#ilog2 e\$B\$Ne(B Fixnum e\$B\$He(B Bignum
[email protected]\$jBX\$o\$j\$G\$N%P%0\$G\$7\$?!#e(B
e\$B?7\$7\$\$\$N\$r;[email protected]\$1\$^\$9\$+!)e(B

1.09 e\$B\$G\$9!#e(B

[ruby-dev:28661] e\$B\$GEDCf\$5\$s\$K;XE&\$5\$l\$?!Ve(BRObjecte\$B\$KKd\$a9~\$`!We(B
e\$B\$H\$\$\$&OC\$b\$\$\$:\$l<h\$jF~\$l\$k\$D\$b\$j\$G\$9!#e(B

e\$B\$M\$P\$?\$G\$9!#CY\$l\$F\$9\$_\$^\$;\$s!#e(B
e\$B<+J,[email protected]\$H5\$IU\$/\$N\$,!"CY\$+\$C\$?!#!#!#e(B

ruby 1.8.4 (2005-12-24) [i386-mswin32]

irb(main):001:0>
irb(main):002:0* require ‘rational’
=> true
irb(main):003:0>
irb(main):004:0* fn = 0
=> 0
irb(main):005:0> p [fn.size, fn.class]
[4, Fixnum]
=> nil
irb(main):006:0> bn = (2**(fn.size*8)-1)
=> 4294967295
irb(main):007:0> p [bn.size, bn.class]
[4, Bignum]
=> nil
irb(main):008:0> r = bn.to_r
=> Rational(4294967295, 1)
irb(main):009:0> p r
Rational(4294967295, 1)
=> nil
irb(main):010:0> f = r.to_f
=> 4294967295.0
irb(main):011:0> p f
4294967295.0
=> nil
irb(main):012:0>

ruby 1.9.0 (2006-05-26) [i386-bccwin32]

C:\ruby19_060526\usr\bin>irb -Ks
irb(main):001:0>
irb(main):002:0* require ‘rational’
=> true
irb(main):003:0>
irb(main):004:0* fn = 0
=> 0
irb(main):005:0> p [fn.size, fn.class]
[4, Fixnum]
=> nil
irb(main):006:0> bn = (2**(fn.size*8)-1)
=> 4294967295
irb(main):007:0> p [bn.size, bn.class]
[4, Bignum]
=> nil
irb(main):008:0> r = bn.to_r
=> Rational(4294967295, 1)
irb(main):009:0> p r
Rational(4294967295, 1)
=> nil
irb(main):010:0> f = r.to_f
=> 4294967295.0
irb(main):011:0> p f
4294967295.0
=> nil
irb(main):012:0>

ruby 1.9.0 (2006-05-13) [i386-bccwin32]e\$B!!\$O!"e(B
[email protected]}\$7\$F\$I\$C\$+\$K9T\$C\$F\$7\$^\$\$\$^\$7\$?!#e(B

e\$B\$U\$J\$P\$G\$9!#e(B

e\$B:F8=\$5\$l\$J\$\$\$N\$OEvA3\$G!"\$M\$P\$?\$5\$s\$O!"86\$5\$s\$Ne(B rational
e\$B\$r\$D\$+\$C\$F\$\$\$Je(B
e\$B\$\$\$+\$i\$G\$9!#\$3\$N7k2L\$r\$_\$?\$H\$3\$m\$G\$O!"e(Brational 1.08
e\$B\$r\$D\$+\$C\$F\$\$\$l\$P!“e(B
e\$B%(%i!<\$K\$J\$C\$F\$\$\$?\$N\$G\$O!”\$H;W\$\$\$^\$9!#e(B

In article [email protected],
Shin-ichiro HARA [email protected] writes:

[ruby-dev:28661] e\$B\$GEDCf\$5\$s\$K;XE&\$5\$l\$?!Ve(BRObjecte\$B\$KKd\$a9~\$`!We(B
e\$B\$H\$\$\$&OC\$b\$\$\$:\$l<h\$jF~\$l\$k\$D\$b\$j\$G\$9!#e(B

e\$B\$=\$&\$\$\$(\$P!"e(BBignum e\$B\$b2DG=\$JHO0O\$Ge(B RObject
e\$B\$KKd\$a9~\$`\$Y\$-\$G\$9e(B
e\$B\$h\$M!#\$=\$&\$9\$l\$P!“J,;RJ,Jl\$,e(B 231 e\$B\$h\$j\$OBg\$-\$\$\$,e(B 296
e\$B\$/\$ie(B
e\$B\$\$\$h\$j\$O>.\$5\$\$\$H\$\$\$&\$”\$?\$j\$G%a%b%[email protected]\$K\$J\$k\$O\$:\$G\$9!#e(B

e\$B\$b\$A\$m\$s\$3\$l\$Oe(B rational e\$B\$H\$OFHN)\$7\$?OC\$G\$"\$C\$F!“86\$5\$s\$,\$I\$&e(B
e\$B\$3\$&\$H\$\$\$&\$3\$H\$G\$O\$J\$/!”\$=\$N\$&\$A5\$\$,8~\$\$\$?\$i;d\$,\$d\$C\$F\$_\$h\$&e(B
e\$B\$+\$H\$\$\$&OC\$J\$s\$G\$9\$,!#\$^\$!\$\$\$D\$+!#\$b\$A\$m\$sB>\$N?M\$,\$d\$C\$F\$b9=e(B
e\$B\$\$\$^\$;\$s\$1\$I!#e(B

e\$B\$U\$J\$P\$G\$9!#e(B

Integer#ilog2 e\$B\$Ne(B Fixnum e\$B\$He(B Bignum [email protected]\$jBX\$o\$j\$G\$N%P%0\$G\$7\$?!#e(B
e\$B?7\$7\$\$\$N\$r;[email protected]\$1\$^\$9\$+!)e(B

e\$B\$O\$\$!#D>\$C\$?\$h\$&\$G\$9!#e(B

e\$BOC\$,\$+\$o\$j\$^\$9\$,!“e(Bmathn
e\$B\$G\$D\$+\$&\$H\$-\$K!”@0?t\$K\$J\$C\$?\$j!"\$J\$i\$J\$+\$C\$?\$je(B
e\$B\$9\$k\$h\$&\$G\$9!#e(B

Rational(1,1) #=> 1
Rational(1) #=> 1/1
1.to_r #=> 1/1
Rational(1,2) + Rational(1,2) #=> 1
Rational(1,2) - Rational(1,2) #=> 0
Rational(1,2) * 2 #=> 1/1
Rational(1,2) / Rational(1,2) #=> 1/1

‘1’.to_r #=> 1/1
‘1.0’.to_r #=> 1
‘1e0’.to_r #=> 1/1
1.rationalize #=> 1/1
1.0.rationalize #=> 1
‘1.0’.rationalize #=> 1
‘1e0’.rationalize #=> 1

[email protected]\$5\$s\$N\$O!"\$3\$s\$J46\$8!#e(B

Rational(1,1) #=> 1
Rational(1) #=> 1
1.to_r #=> 1
Rational(1,2) + Rational(1,2) #=> 1
Rational(1,2) - Rational(1,2) #=> 0
Rational(1,2) * 2 #=> 1
Rational(1,2) / Rational(1,2) #=> 1

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

e\$B\$U\$J\$P\$G\$9!#e(B

e\$BOC\$,\$+\$o\$j\$^\$9\$,!“e(Bmathn e\$B\$G\$D\$+\$&\$H\$-\$K!”@0?t\$K\$J\$C\$?\$j!"\$J\$i\$J\$+\$C\$?\$je(B
e\$B\$9\$k\$h\$&\$G\$9!#e(B

e\$BBP:v\$,IT==J,\$G\$7\$?!#\$b\$A\$m\$sI8=`\$Ne(B rational.rb
e\$B\$H%3%s%Q%A\$K\$7\$^\$9!#e(B
e\$B!"!"!"\$7\$^\$7\$?!#e(B

e\$B\$U\$J\$P\$G\$9!#e(B

‘.9’.to_r e\$B\$H\$\$\$C\$?\$b\$N\$,%(%i!<\$K\$J\$j\$^\$9!#e(B

e\$B4pK\E*\$Ke(B String#to_X
e\$B\$O=q<0\$K\$D\$\$\$F%(%i!<[email protected]\$H;W\$&\$N\$G\$9e(B
e\$B\$,!“e(BString#to_r
e\$B\$O\$I\$s\$I\$s%(%i!<\$K\$7\$^\$9!#\$3\$N\$”\$?\$j\$O?6Iq\$\$\$r0lCW\$5\$;e(B
[email protected]\$H;W\$&\$N\$G\$9\$,!"\$I\$&\$G\$7\$g\$&!#e(B

‘+_9’ e\$B\$O%@e(B

# e\$B%[email protected]\$,e(B ‘_+9’ e\$B\$O\$h\$\$!"\$J\$I%/%;\$,\$"\$k\$h\$&\$G\$9\$,!#e(B

‘’.to_i #=> 0
‘’.to_f #=> 0.0
‘’.to_d #=> #BigDecimal:81c1f14,‘0.0’,4(4)
‘’.to_r # ArgumentError *

“+_9”.to_i #=> 9
“+_9”.to_f #=> 0.0 *
“+_9”.to_d #=> #BigDecimal:81c0240,‘0.0’,4(4) *
“+_9”.to_r #=> 9/1

+9".to_i #=> 9
"
+9”.to_f #=> 9.0
+9".to_d #=> #BigDecimal:81be594,‘0.0’,4(4) *
"
+9”.to_r # ArgumentError *

“.9”.to_i #=> 0
“.9”.to_f #=> 0.9
“.9”.to_d #=> #BigDecimal:81bcde8,‘0.9E0’,4(8)
“.9”.to_r # ArgumentError *

“9_.9".to_i #=> 9
"9
.9".to_f #=> 9.9
"9
.9".to_d #=> #BigDecimal:81c54c0,‘0.9E1’,4(8) *
"9
._9”.to_r #=> 99/10

“_.9".to_i #=> 0
"
.9".to_f #=> 0.0 *
"
.9".to_d #=> #BigDecimal:81bee68,‘0.0’,4(4) *
"
._9”.to_r # ArgumentError *

“+9\t9”.to_i #=> 9
“+9\t9”.to_f #=> 9.0
“+9\t9”.to_d #=> #BigDecimal:81d37c8,‘0.99E2’,4(8) *
“+9\t9”.to_r # ArgumentError *

“9e+_9”.to_i #=> 9
“9e+_9”.to_f #=> 9000000000.0
“9e+_9”.to_d #=> #BigDecimal:80f3ab8,‘0.9E1’,4(8) *
“9e+_9”.to_r # ArgumentError *

nil.to_i #=> 0
nil.to_f #=> 0.0
nil.to_d # NoMethodError
nil.to_r # NoMethodError

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

In message “Re: [ruby-dev:28830] Re: rational 1.08”
on Sat, 24 Jun 2006 23:53:30 +0900, Tadayoshi F.
[email protected] writes:

|# [email protected]!“D4\$Y\$F\$_\$k\$H!”%(%i!<\$K\$O\$J\$i\$J\$\$\$b\$N\$N!“e(Bto_f e\$B\$N>l9ge(B ‘+9’ e\$B\$O%@e(B
|# e\$B%[email protected]\$,e(B '
+9’ e\$B\$O\$h\$\$!”\$J\$I%/%;\$,\$"\$k\$h\$&\$G\$9\$,!#e(B

e\$BBP=h\$7\$^\$9!#e(B

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

e\$B\$U\$J\$P\$G\$9!#e(B

‘.9’.to_r e\$B\$H\$\$\$C\$?\$b\$N\$,%(%i!<\$K\$J\$j\$^\$9!#e(B

e\$B4pK\E*\$Ke(B String#to_X e\$B\$O=q<0\$K\$D\$\$\$F%(%i!<[email protected]\$H;W\$&\$N\$G\$9e(B
e\$B\$,!“e(BString#to_r e\$B\$O\$I\$s\$I\$s%(%i!<\$K\$7\$^\$9!#\$3\$N\$”\$?\$j\$O?6Iq\$\$\$r0lCW\$5\$;e(B
[email protected]\$H;W\$&\$N\$G\$9\$,!"\$I\$&\$G\$7\$g\$&!#e(B

e\$B\$\$C\$7\$c\$k\$H\$\$j\$G\$9\$M!#\$=\$N\$h\$&\$K\$7\$^\$7\$?!#e(B

rational-1.10 e\$B\$G\$9!#e(B

String#to_r e\$B\$K\$O\$^[email protected]\$\$\$,\$"\$j\$^\$9e(B(“3.14/2”.to_r
e\$B\$r\$I\$&\$7\$h\$&\$H\$+!K!#e(B

[email protected]?tItJ,\$d>.?tItJ,\$rFI\$`e(Bparsere\$B\$Oe(Bruby
e\$BK\BN\$N\$r;H\$\$\$?\$\$\$N\$Ge(B
e\$B\$9\$,!":#\$N=j\$=\$N\$h\$&\$K\$O\$J\$C\$F\$J\$\$\$N\$G!"\$I\$&\$7\$h\$&\$+\$H;W\$C\$F\$\$e(B
e\$B\$^\$9!#e(B

# e\$B%[email protected]\$,e(B ‘_+9’ e\$B\$O\$h\$\$!"\$J\$I%/%;\$,\$"\$k\$h\$&\$G\$9\$,!#e(B

e\$B\$&\$&\$`!#e(B

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

In message “Re: [ruby-dev:28868] Re: rational 1.08”
on Tue, 27 Jun 2006 21:38:03 +0900, Yukihiro M.
[email protected] writes:

|In message “Re: [ruby-dev:28830] Re: rational 1.08”
| on Sat, 24 Jun 2006 23:53:30 +0900, Tadayoshi F. [email protected] writes:
|
||# [email protected]!“D4\$Y\$F\$_\$k\$H!”%(%i!<\$K\$O\$J\$i\$J\$\$\$b\$N\$N!“e(Bto_f e\$B\$N>l9ge(B ‘+9’ e\$B\$O%@e(B
||# e\$B%[email protected]\$,e(B '
+9’ e\$B\$O\$h\$\$!”\$J\$I%/%;\$,\$"\$k\$h\$&\$G\$9\$,!#e(B
|
|e\$BBP=h\$7\$^\$9!#e(B

to_ie\$B\$He([email protected],\$Ne(B _
e\$B\$rL5;k\$9\$k!W\$H\$\$\$&5sF0\$K\$J\$C\$F\$\$\$^\$7e(B
e\$B\$?!#\$7\$+\$7!"e(BRubye\$B\$N?t\$OESCf\$NG\$0U\$N>l=j\$Ke(B _
e\$B\$rF~\$l\$i\$l\$^\$9\$,!“e(B
[email protected],\$K\$OF~\$j\$^\$;\$s\$+\$i!”[email protected]\$7\$/[email protected]\$H;W\$\$\$^\$9!#e(B
e\$B\$h\$C\$F!“e(B(e\$B\$H\$j\$”\$(\$:e(B1.9e\$B\$Ge(B)[email protected]\$7\$^\$9!#JQ998e\$N7k2L\$O0J2<\$NDLe(B
e\$B\$j\$G\$9!#e(B

‘’.to_i #=> 0
‘’.to_f #=> 0.0

“+_9”.to_i #=> 0 *
“+_9”.to_f #=> 0.0

+9".to_i #=> 0 *
"
+9”.to_f #=> 0.0 *

“.9”.to_i #=> 0
“.9”.to_f #=> 0.9

“9_.9".to_i #=> 9
"9
._9”.to_f #=> 9.9

“_.9".to_i #=> 0 *
"
._9”.to_f #=> 0.0 *

“+9\t9”.to_i #=> 9
“+9\t9”.to_f #=> 9.0

“9e+_9”.to_i #=> 9
“9e+_9”.to_f #=> 9000000000.0

BigDecimale\$B\$de(BRationale\$B\$K\$D\$\$\$F\$O\$3\$l\$K=`\$:[email protected]\$H;W\$\$\$^\$9!#e(B

e\$B>.NS\$G\$9!#e(B

----- Original Message -----
From: “Yukihiro M.” [email protected]
Subject: [ruby-dev:28872] Re: rational 1.08

e\$B\$J\$+\$J\$+<j\$,2s\$i\$J\$\$\$N\$,8=>u\$G\$9\$,!%!%!%e(B

to_ie\$B\$He([email protected],\$Ne(B _ e\$B\$rL5;k\$9\$k!W\$H\$\$\$&5sF0\$K\$J\$C\$F\$\$\$^\$7e(B
e\$B\$?!#\$7\$+\$7!"e(BRubye\$B\$N?t\$OESCf\$NG\$0U\$N>l=j\$Ke(B _ e\$B\$rF~\$l\$i\$l\$^\$9\$,!“e(B
[email protected],\$K\$OF~\$j\$^\$;\$s\$+\$i!”[email protected]\$7\$/[email protected]\$H;W\$\$\$^\$9!#e(B
e\$B\$h\$C\$F!“e(B(e\$B\$H\$j\$”\$(\$:e(B1.9e\$B\$Ge(B)[email protected]\$7\$^\$9!#JQ998e\$N7k2L\$O0J2<\$NDLe(B
e\$B\$j\$G\$9!#e(B

“+_9”.to_i #=> 0 *
“+_9”.to_f #=> 0.0
‘+’ or ‘-’ [email protected],!W\$J\$N\$G\$7\$g\$&\$+!)e(B

BigDecimale\$B\$de(BRationale\$B\$K\$D\$\$\$F\$O\$3\$l\$K=`\$:[email protected]\$H;W\$\$\$^\$9!#e(B e\$BN;2r\$G\$9\$,!"e(B e\$B!!#1!%J8;[email protected],\$K\$"\$k%9%Z!<%9!Je(B' ',\t,\b,\n e\$BEy\$b4^\$`!K\$O!)e(B
e\$B!!#2!%e(B"1E3".to_i ==> 1 e\$B!Je(B1.8.4e\$B!K\$+e(B 1000 e\$B!)e(B
e\$B!!#3!%IbF0>.?t%G!<%?\$r<h\$j9~\$`>l9ge(B “1.3D-4”
e\$BEy\$N%G!<%?I=8=\$OB?\$\$!#e(B
“1.3D-4"e\$B\$be(B"1.3E-4"e\$BF1MM\$KIbF0>.?t\$H\$7\$FG’<1\$7\$F\$[\$7\$\$\$G\$9!#e(B
e\$B!!#4!%:#2s\$O%9%Z!<%9!J\$H?t;z0J30\$NJ8;z!K!”\$=\$l\$Ke(B ‘_’
e\$B\$N<h\$j07\$\$\$N:90[e(B
e\$B!!!\$,LdBj!#\$3\$l\$i\$r8D!9\$K=hM}\$9\$k\$N\$OF1MM\$JLdBj\$r:#8e\$b0z\$-5/e(B
e\$B!!!\$3\$9\$N\$G\$OL5\$\$\$G\$7\$g\$&\$+!JBg\$-\$JLdBj\$H\$O;W\$\$\$^\$;\$s\$,!D!K!)e(B
e\$B!!!\$G\$-\$l\$Pe(B rb_normalize_numeric_string(numericlike_string)
e\$B\$N\$h\$&\$Je(B
e\$B!!!4X?t\$G\$^\$H\$a\$i\$l\$J\$\$\$G\$7\$g\$&\$+!)e(B
e\$B!!!J7k2L\$H\$7\$Fe(B
'+‘e\$B!"e(B’-'e\$B!“e(B’E’e\$B!”?t;z!"\$=\$l\$i0J30\$O4^\$^\$J\$\$!V0lHLE*\$J!We(B
e\$B???tCMI=8=\$,[email protected]\$i\$l\$k!#!Ke(B

e\$B:G8e\$K!“2?J,e(B C e\$B\$de(B FORTRAN e\$B0J30\$NCN<1\$,K3\$7\$/!”?tCMCf\$Ne(B
'’ e\$B\$rFCJLe(B
e\$B07\$\$\$9\$k0UL#\$,\$o\$+\$j\$^\$;\$s!#B>\$KF1MM\$J=hM}7O\$,B8:
\$9\$k\$N\$G\$7\$g\$&\$,!“e(B
‘_’ e\$B\$rFCJL\$K07\$&%a%j%C%H\$r65\$(\$FD:\$1\$l\$P\$”\$j\$,\$?\$\$\$G\$9!#e(B

e\$B0J>e\$G\$9!#e(B

e\$B>.NSe(B e\$BLPM:e(B

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

In message “Re: [ruby-dev:28885] Re: rational 1.08”
on Wed, 28 Jun 2006 14:09:58 +0900, “Shigeo Kobayashi”
[email protected] writes:

|> “+_9”.to_i #=> 0 *
|> “+_9”.to_f #=> 0.0
|’+’ or ‘-’ [email protected],!W\$J\$N\$G\$7\$g\$&\$+!)e(B

e\$B\$O\$\$!#?t;z\$N4V\$Ke(B _ e\$B\$r5v\$9\$H2r<a\$7\$F\$/[email protected]\$5\$\$!#e(B

|> BigDecimale\$B\$de(BRationale\$B\$K\$D\$\$\$F\$O\$3\$l\$K=`\$:[email protected]\$H;W\$\$\$^\$9!#e(B |e\$BN;2r\$G\$9\$,!"e(B |e\$B!!#1!%J8;[email protected],\$K\$"\$k%9%Z!<%9!Je(B' ',\t,\b,\n e\$BEy\$b4^\$`!K\$O!)e(B

[email protected],\$K\$"\$ke(BISSPACE()e\$B\$,@.N)\$9\$kJ8;z\$OL5;k\$7\$F\$/[email protected]\$5\$\$!#e(B

|e\$B!!#2!%e(B"1E3".to_i ==> 1 e\$B!Je(B1.8.4e\$B!K\$+e(B 1000 e\$B!)e(B

1e\$B\$G\$9!#e(Bto_ie\$B\$O;X?tI=5-\$r2r<a\$7\$^\$;\$s!#e(B

|e\$B!!#3!%IbF0>.?t%G!<%?\$r<h\$j9~\$`>l9ge(B “1.3D-4” e\$BEy\$N%G!<%?I=8=\$OB?\$\$!#e(B
| "1.3D-4"e\$B\$be(B"1.3E-4"e\$BF1MM\$KIbF0>.?t\$H\$7\$FG’<1\$7\$F\$[\$7\$\$\$G\$9!#e(B

e\$B\$=\$&\$J\$s\$G\$9\$+!#e(Bee\$B\$Oe([email protected]\$HJ9\$\$\$F\$\$\$^\$9\$,!"\$3\$N>l9g\$Ne(B
d/De\$B\$O\$I\$&\$\$\$&0UL#\$J\$s\$G\$7\$g\$&\$+!#e(B

|e\$B!!#4!%:#2s\$O%9%Z!<%9!J\$H?t;z0J30\$NJ8;z!K!"\$=\$l\$Ke(B ‘_’ e\$B\$N<h\$j07\$\$\$N:90[e(B
|e\$B!!!\$,LdBj!#\$3\$l\$i\$r8D!9\$K=hM}\$9\$k\$N\$OF1MM\$JLdBj\$r:#8e\$b0z\$-5/e(B
|e\$B!!!\$3\$9\$N\$G\$OL5\$\$\$G\$7\$g\$&\$+!JBg\$-\$JLdBj\$H\$O;W\$\$\$^\$;\$s\$,!D!K!)e(B
|e\$B!!!\$G\$-\$l\$Pe(B rb_normalize_numeric_string(numericlike_string) e\$B\$N\$h\$&\$Je(B
|e\$B!!!4X?t\$G\$^\$H\$a\$i\$l\$J\$\$\$G\$7\$g\$&\$+!)e(B
|e\$B!!!J7k2L\$H\$7\$Fe(B '+‘e\$B!"e(B’-'e\$B!“e(B’E’e\$B!”?t;z!"\$=\$l\$i0J30\$O4^\$^\$J\$\$!V0lHLE*\$J!We(B
|e\$B???tCMI=8=\$,[email protected]\$i\$l\$k!#!Ke(B

e\$B8=:_!"?tCMI=5-\$r2r<a\$9\$k%k!<%A%[email protected]?te(B(rb_cstr_to_inum)e\$B\$HIbe(B
e\$BF0>[email protected]?te(B(ruby_cstr_to_dbl)e\$B\$N\$U\$?\$D\$K\$^\$H\$a\$i\$l\$F\$\$\$^\$9!#e(B
[email protected]?t\$HIbF0>[email protected]?t\$O%k!<%k\$,0c\$&\$N\$G!"E}0l\$9\$k\$N\$OFq\$7\$\$\$H;We(B
e\$B\$\$\$^\$9!#e(B

|e\$B:G8e\$K!“2?J,e(B C e\$B\$de(B FORTRAN e\$B0J30\$NCN<1\$,K3\$7\$/!”?tCMCf\$Ne(B ‘’ e\$B\$rFCJLe(B
|e\$B07\$\$\$9\$k0UL#\$,\$o\$+\$j\$^\$;\$s!#B>\$KF1MM\$J=hM}7O\$,B8:
\$9\$k\$N\$G\$7\$g\$&\$,!"e(B
|’_’ e\$B\$rFCJL\$K07\$&%a%j%C%H\$r65\$(\$FD:\$1\$l\$P\$"\$j\$,\$?\$\$\$G\$9!#e(B

e\$B<[email protected]?t\$G\$9\$,!"#37ee(B(e\$B\$"\$k\$\$\$O#47ee(B)[email protected]\$j\$H\$7\$F;H\$(\$k\$he(B
e\$B\$&\$Ke(B _ e\$B\$r5v\$7\$F\$\$\$^\$9!#\$3\$l\$Oe(BPerle\$B\$G\$bF1MM\$G\$9!#e(B

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

e\$B>.NS\$G\$9!#e(B

----- Original Message -----
From: “Yukihiro M.” [email protected]
Subject: [ruby-dev:28887] Re: rational 1.08

|’+’ or ‘-’ [email protected],!W\$J\$N\$G\$7\$g\$&\$+!)e(B

e\$B\$O\$\$!#?t;z\$N4V\$Ke(B _ e\$B\$r5v\$9\$H2r<a\$7\$F\$/[email protected]\$5\$\$!#e(B
“._02”.to_f => 0.0 e\$B\$bF1MM\$G\$9\$M!#e(B

|e\$B!!#3!%IbF0>.?t%G!<%?\$r<h\$j9~\$`>l9ge(B “1.3D-4” e\$BEy\$N%G!<%?I=8=\$OB?\$\$!#e(B
| "1.3D-4"e\$B\$be(B"1.3E-4"e\$BF1MM\$KIbF0>.?t\$H\$7\$FG’<1\$7\$F\$[\$7\$\$\$G\$9!#e(B

e\$B\$=\$&\$J\$s\$G\$9\$+!#e(Bee\$B\$Oe([email protected]\$HJ9\$\$\$F\$\$\$^\$9\$,!"\$3\$N>l9g\$Ne(B
d/De\$B\$O\$I\$&\$\$\$&0UL#\$J\$s\$G\$7\$g\$&\$+!#e(B
e\$B:#99e(BFORTRANe\$B\$bL5\$\$\$h\$&\$J5\$\$b\$7\$^\$9\$1\$I!"@N\$N4QB,%G!<%?e(B
e\$BEy\$K\$O7k9=\$"\$j\$^\$9!#\$3\$3\$i\$X\$s\$O!"\$^\$!5\$;}\$A\$NLdBj\$G!"%j%Fe(B
e\$B%i%k\$r4:\$(\$FA}\$d\$9\$[\$I\$N;[email protected]\$(\$J\$/\$b\$J\$\$\$G\$9\$M\$’!%!%!%e(B

e\$B<[email protected]?t\$G\$9\$,!"#37ee(B(e\$B\$"\$k\$\$\$O#47ee(B)[email protected]\$j\$H\$7\$F;H\$(\$k\$he(B
e\$B\$&\$Ke(B _ e\$B\$r5v\$7\$F\$\$\$^\$9!#\$3\$l\$Oe(BPerle\$B\$G\$bF1MM\$G\$9!#e(B
e\$B\$"\$"!"\$=\$&\$J\$s\$G\$9\$M!De(B
e\$B\$&!<\$s!“2?\$+M}M3\$,\$”\$k\$N\$G\$7\$g\$&\$,!";d\$J\$ie(B
“1,000”.to_i ==> 1000
e\$B\$NJ}\$,!J>/\$7!K\$&\$l\$7\$\$\$G\$9!#e(B

# e\$BBg6Z\$GN;2r\$\$\$?\$7\$^\$7\$?!#e(B

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

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

“9_._9”.to_f #=> 9.9

Float(“9_._9”) e\$B\$O\$I\$&\$7\$^\$9!)8=>u\$G\$ONc30\$G\$9\$,!#e(B

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

In message “Re: [ruby-dev:28891] Re: rational 1.08”
on Wed, 28 Jun 2006 19:20:59 +0900, Shin-ichiro HARA
[email protected] writes:

|>“9_.9".to_f #=> 9.9
|
|Float("9
._9”) e\$B\$O\$I\$&\$7\$^\$9!)8=>u\$G\$ONc30\$G\$9\$,!#e(B

e\$B\$"\$"!"\$4\$a\$s\$J\$5\$\$!#\$3\$l\$Oe(Bto_ie\$B\$G\$be(Bto_fe\$B\$G\$b%<%m\$K\$J\$k\$Y\$-\$G\$9!#e(B
e\$B\$G!"e(BFloat()e\$B\$G\$ONc30!#e(B

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