Project

General

Profile

Bug #1841

Float internal problem in ruby1.9.2dev (2009-07-18)

Added by Eregon (Benoit Daloze) about 11 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2009-07-18) [i386-mswin32_90]
Backport:
[ruby-core:24620]

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


Related issues

Related to Ruby master - Bug #3365: floats revisited (see bug 1841)Rejected05/30/2010Actions
#1

Updated by shyouhei (Shyouhei Urabe) about 11 years ago

  • Status changed from Open to Rejected

=begin
Welcome to the real world. Take a little look at IEEE754.
=end

#2

Updated by Eregon (Benoit Daloze) about 11 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

#3

Updated by shyouhei (Shyouhei Urabe) about 11 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

#4

Updated by Eregon (Benoit Daloze) about 11 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

#5

Updated by rogerdpack (Roger Pack) about 11 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

#6

Updated by shyouhei (Shyouhei Urabe) about 11 years ago

=begin
Maybe. To discuss that we need a new ticket.
=end

Also available in: Atom PDF