[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:29177] Re: [Feature #2152] Split functionality of Float#inspect and Float#to_s

From: Yusuke ENDOH <mame@...>
Date: 2010-03-31 19:39:23 UTC
List: ruby-core #29177
Hi,

2010/4/1 Benoit Daloze <eregontp@gmail.com>:
>> 1) First, there is currently a bug in trunk:
>>
>> 72.9.to_s # ==> "72.90000000000001"
>>
>> #to_s (and #inspect) should choose the simplest string representation that is included in the approximate range a float represents.
>
> That's what we ask for #to_s

No.  You are asking the different behavior from Marc-Andre.

Marc-Andre is insisting it choose the simplest representation
*without inaccuracy*.  But the old behavior you want chooses
a simple one *that may be even inaccurate*.


>> 2) Calculations between floats introduce errors due to these approximations. For example:
>>
>> (1-0.9) == 0.1 # ==> false
>>
>> This feature request asks that (1-0.9).to_s ?# => "0.1"
>
> No, but it's one consequence. 1.8 behave like this. Nobody would ever
> want to compare the String representations to compare the value...

Even in 1.8, the following returns the result including error:

  p 1.4 - 0.1 - 1.2  #=> 0.0999999999999999

It may cause a bug that is hard to test and reproduce.


Honestly, I used to like the old behavior.  But I knew that the
implementation of the old behavior was very uncool and dirty.
It is almost like:

  ("%.15f" % float).sub(/0+$/, "")

Now I dislike the old behavior.

-- 
Yusuke ENDOH <mame@tsg.ne.jp>

In This Thread