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

From: Nobuyoshi Nakada <nobu@...>
Date: 2009-04-11 07:02:53 UTC
List: ruby-core #23180
Hi,

At Sat, 11 Apr 2009 15:17:24 +0900,
Roger Pack wrote in [ruby-core:23179]:
> Is this satisfactory, or would anyone still prefer Float#to_s
> => rounded, Float#inspect => non rounded (i.e. 0.9.inspect =>
> "0.8999999999")?  Just wondering since I brought up this mess
> :)

I had another thought, Float#to_s could take an optional
argument to specify the precision or the format.

e.g.:

  0.9.to_s(3)   #=> "0.900"
  0.9.to_s("e") #=> "9.000000e-01"
  0.9.to_s(prec: 4, width: 6) #=> " 9.000"

-- 
Nobu Nakada

In This Thread