--0016364d212f578ef20483a94b5e
Content-Type: text/plain; charset=ISO-8859-1

Hi,
On 7 April 2010 19:02, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:

> Hi,
>
> As I stated in [ruby-core:27631], I don't object about having two
> string representation, one "human readable" and the other "more
> verbose".  Even though I am not fully against, it doesn't mean, I
> enjoy having two representation.  Float is float is float.  We should
> know about error when you treat with float, shouldn't we?
>
> Anyway, I feel like we still have two points:
>
> (1) We've got consensus which method to behave which so far.  Since
>    #inspect is a method for "human readable" string representation,
>    I think it is more suitable to get "human readable" float
>    representation.  Others want to #to_s to be "human readable" to
>    ease "Float #{f}".
>
> (2) Besides that, I am not sure whether the old behavior is the best
>    way to generate "human readable" representation.
>
>                                                        matz.
>
>
Then let's choose which representation is "human readable", maybe a third
one?

I spoke a bit about that in my last post, while I fear I'm more of a
beginner about technique:

So, double have a range (between two of them) of 2e-52 ~ 10e-16. Should we
then round at
15~16 digits ?

> n  .4 - 0.1 - 1.2
0.09999999999999987
> "%.15f" % n
"0.100000000000000"
> "%.16f" % n
"0.0999999999999999"

So I think most people would agree with the "%.15f" result (without the
zeros of course).
The question is then: How to do it properly ?

P.S.: To my opinion, #inspect is usually more verbose than #to_s, so I
continue staying straight in my idea.
The bad thing with Float is you currently still need to "my Float: #{"%.2f"
% f}"
Inspect is, to my opinion, used mostly when debugging, almost never to print
result.
So if there is a verbose representation, I think it belongs to #inspect.
(I expect to have precise, even too verbose output when I 'p f')

--0016364d212f578ef20483a94b5e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class="gmail_quote">Hi,</div><div class="gmail_quote">On 7 April 2010 19:02, Yukihiro Matsumoto <span dir="ltr">&lt;matz / ruby-lang.org&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br><br>As I stated in [ruby-core:27631], I don&#39;t object about having two<br>
string representation, one &quot;human readable&quot; and the other &quot;more<br>
verbose&quot;.      ɼenjoy having two representation.       
know about error when you treat with float, shouldn&#39;t we?<br>
<br>
Anyway, I feel like we still have two points:<br>
<br>
(1) We&#39;ve got consensus which method to behave which so far.  
 inspect is a method for &quot;human readable&quot; string representation,<br>
                  
  <br>
(2) Besides that, I am not sure whether the old behavior is the best<br>
      <br>
  
<br></blockquote><div>/div></div>Then let&#39;s choose which representation is &quot;human readable&quot;, maybe a third one?<div><br></div><div>Ipoke a bit about that in my last post, while I fear I&#39;m more of a beginner about technique:</div>

<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">So, doubleave a range (between two of them) of 2e-52 ~ 10e-16. Should we then roundt<br>

15~16 digits ?<br><br>&gt; n = 1.4 - 0.1 - 1.2<br>=&gt; 0.09999999999999987<br>&gt; &quot;%.15f&quot; % n<br>=&gt; &quot;0.100000000000000&quot;<br>&gt; &quot;%.16f&quot; % n<br>=&gt; &quot;0.0999999999999999&quot;</span></div>

<div><br></div><div>So I think most people would agree with the &quot;%.15f&quot; result (without the zeros of course).</div><div>The question is then: How to do it properly ?</div><div><br></div><div>P.S.: To my opinion, #inspect is usually more verbose than #to_s, so I continue staying straight iny idea.</div>

<div>The bad thing with Float is you currently still need to &quot;my Float: #{&quot;%.2f&quot; % f}&quot;</div><div>Inspect is, to my opinion, used mostly when debugging, almost never to print result.</div><div>So if there is a verbose representation, I think it belongs to #inspect.</div>

<div>(I expect to have precise, even too verbose output when I &#39;p f&#39;)</div>

--0016364d212f578ef20483a94b5e--