[#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:23145] Re: [Bug #1336] Change in string representation of Floats

From: Tanaka Akira <akr@...>
Date: 2009-04-07 02:19:42 UTC
List: ruby-core #23145
In article <C5FF8E50.259E9%gus@progress.com>,
  gus <gus@progress.com> writes:

> The fact that the base 10 rational numbers and the base 2 rational numbers
> do not have the /same/ set of values that require infinite expansions means
> that some numbers can be represented exactly in base 10 but not in base 2,
> and vice versa. When converting from one base to the other, this will
> introduce small errors because the conversion cannot be made exact.

No numbers in base 2 cannot be represented exactly in base 10.

1/2**1 = 0.5
1/2**2 = 0.25
1/2**3 = 0.125
1/2**4 = 0.0625
1/2**5 = 0.03125
...

Any bit in base 2 can be represented exactly in base 10.

Therefore, any number in base 2, which is a sum of some of
them, is exactly representable in base 10.
-- 
Tanaka Akira

In This Thread