[#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:29176] Re: [Feature #2152] Split functionality of Float#inspect and Float#to_s

From: Benoit Daloze <eregontp@...>
Date: 2010-03-31 19:04:14 UTC
List: ruby-core #29176
> Issue #2152 has been updated by Marc-Andre Lafortune.
>
> There are two different issues here.
>
> 1) First, there is currently a bug in trunk:
>
> 72.9.to_s # =3D=3D> "72.90000000000001"
>
> #to_s (and #inspect) should choose the simplest string representation tha=
t is included in the approximate range a float represents.

That's what we ask for #to_s
We'd like to keep #inspect to find easily why a calculation is wrong
(and even if you know how Float are, this security is really not too
much, so much "bugs" can happen)

>
> In other words, if string_rep_1.to_f =3D=3D string_rep_2.to_f, then the s=
implest of string_rep_1 and string_rep_2 is to be preferred.
>

Agreed for to_s, inspect is here irrelevant.

> 2) Calculations between floats introduce errors due to these approximatio=
ns. For example:
>
> (1-0.9) =3D=3D 0.1 # =3D=3D> false
>
> This feature request asks that (1-0.9).to_s =A0# =3D> "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...

> I object to this, because 1-0.9 is not =3D=3D to 0.1 and thus should not =
have the same string representation.

I think it should. It's in fact inconsistent now to read from a String
"72.9".to_f.to_s
Again, inspect has no matter with it. It's intended for showing full
representation as I think.

> I would recommend that instead we consider adding (probably in 1.9.3) an =
optional argument to Float#to_s that would limit the number of decimal show=
ing, for instance.

That's a good idea, better than old way "%.20f" % 0.1

I think we really need the old #to_s for 1.9.2, it's definitely
inconsistent the current representation.
Do you agree?

In This Thread