[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23324] Re: [Feature #1408] 0.1.to_r not equal to (1/10)

From: Heesob Park <phasis@...>
Date: 2009-04-27 00:48:51 UTC
List: ruby-core #23324
2009/4/27 Martin DeMello <martindemello@gmail.com>:
> On Sun, Apr 26, 2009 at 2:51 PM, Heesob Park <redmine@ruby-lang.org> wrote:
>>
>> $ ruby -e 'p 0.1.to_r'
>> (3602879701896397/36028797018963968)
>>
>> whereas
>>
>> $ ruby -e 'p "0.1".to_r'
>> (1/10)
>
> What, in theory, could be done about this? By the time to_r is
> invoked, 0.1 is already a binary float, with the implicit rounding
> off.
>
In theory, Float#to_r  could be done through Float#to_s#to_r.

Regards,

Park Heesob

In This Thread