Bug #1841
closedFloat internal problem in ruby1.9.2dev (2009-07-18)
Description
=begin
ruby 1.9.1 and earlier
729/10.0
=> 72.9
ruby 1.9.2dev (2009-07-18) [i386-mswin32_90]
build this morning with VC++Express08
729/10.0
=> 72.90000000000001
or even
72.9
=> 72.90000000000001
72.9 == 72.90000000000001
=> true
Is it just a problem with Float#to_s ?
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
- Status changed from Open to Rejected
=begin
Welcome to the real world. Take a little look at IEEE754.
=end
Updated by Eregon (Benoit Daloze) over 15 years ago
=begin
Yeah, I know about the general problem of floats. Not the first time I got something unexpected.
I wouldn't wonder if it was the same behavior before.
But here it's different. It changed between 1.9.1 and 1.9.2. Why? I suppose the Float class didn't change so much.
Why on world then the Float#to_s changed?
And I think this issue is important, because you can't anymore round a Float to x decimal and show it in a shell, it will take 16digits instead of the 2+x expected...
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=begin
There was a discussion around Float's string representation after 1.9.1 was released.
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-core/22325?22249-23532+split-mode-vertical
This change is due to that.
=end
Updated by Eregon (Benoit Daloze) over 15 years ago
=begin
Well, I'm according for this behavior for Float#inspect. But I'll prefer the old one for Float#to_s. As many people said.
Thanks for the answer.
=end
Updated by rogerdpack (Roger Pack) over 15 years ago
=begin
It is true that Float#to_s and Float#inspect currently have the same behavior. Perhaps they could be split to do different things, before the code freeze for 1.9.2?
=r
=end
Updated by shyouhei (Shyouhei Urabe) over 15 years ago
=begin
Maybe. To discuss that we need a new ticket.
=end