Project

General

Profile

Actions

Bug #5309

closed

0.6.to_r != "0.6".to_r

Added by brixen (Brian Shirai) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
-
Backport:
[ruby-core:39484]

Description

0.6.to_r != "0.6".to_r

Is this a bug?

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

$ irb
ruby-1.9.2-p290 :001 > 0.6.to_r
=> (5404319552844595/9007199254740992)
ruby-1.9.2-p290 :002 > "0.6".to_r
=> (3/5)
ruby-1.9.2-p290 :003 > a = "%.55f" % 0.6
=> "0.5999999999999999777955395074968691915273666381835937500"
ruby-1.9.2-p290 :004 > b = "%.55f" % "0.6".to_f
=> "0.5999999999999999777955395074968691915273666381835937500"
ruby-1.9.2-p290 :005 > a == b
=> true

Thanks,
Brian


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Feature #1408: 0.1.to_r not equal to (1/10)Closedmatz (Yukihiro Matsumoto)04/26/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0