Bug #1841
Float internal problem in ruby1.9.2dev (2009-07-18)
| Status: | Rejected | Start date: | 07/30/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | core | |||
| Target version: | 1.9.2 | |||
| ruby -v: | ruby 1.9.2dev (2009-07-18) [i386-mswin32_90] |
Description
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 ?
Related issues
History
Updated by shyouhei (Shyouhei Urabe) almost 3 years ago
- Status changed from Open to Rejected
Welcome to the real world. Take a little look at IEEE754.
Updated by Eregon (Benoit Daloze) almost 3 years ago
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...
Updated by shyouhei (Shyouhei Urabe) almost 3 years ago
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.
Updated by Eregon (Benoit Daloze) almost 3 years ago
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.
Updated by rogerdpack (Roger Pack) almost 3 years ago
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
Updated by shyouhei (Shyouhei Urabe) almost 3 years ago
Maybe. To discuss that we need a new ticket.