From: David MacMahon Date: 2013-02-22T09:28:43+09:00 Subject: [ruby-core:52667] Re: [ruby-trunk - Bug #7829] Rounding error in Ruby Time On Feb 20, 2013, at 11:17 AM, David MacMahon wrote: > Interestingly, Ruby 1.9 has String#to_r which leads to this:: > >>> Time.utc(1970,1,1,0,0,12.86.to_s.to_r).strftime("%H:%M:%S,%L") > => "00:00:12,860" Even more interestingly, Ruby 1.9 also has Float#rationalize which leads to this: irb(main):001:0> Time.utc(1970,1,1,0,0,12.86.rationalize).strftime("%H:%M:%S,%L") => "00:00:12,860" What do people thing about changing num_exact() in time.c to call #rationalize for Floats rather than #to_r? Or perhaps call #rationalize on the object if it responds to #rationalize so that this won't be exclusive to Floats? Dave