If you are using '==' or '!=' on computed floating point values, then you've already lost my sympathy

I, of course, am completely shattered at having lost your sympathy ;-)

... we got tons of complaints because the result of code like ... <snip> ... was not a nice "0.5" but "0.5000000000000002".

The output of that code is *still* not nice, even today. Try it and you'll see.
We need to get the output precision further reduced.

Seriously ... you can reduce the decimal precision of print even further, and that sort of procedure can still produce results that are "not nice":
perl -le "for(1..100000000) {$x += 0.01}print $x;" 1000000.00077928
We need to reduce displayed output to no more than 10 decimal digits ?? (Even less)

The "unniceness" of those results come from cumulatively adding a value that is not precisely 1/100.
I don't see that it has much to do with the decimal precision of print()'s output.

People who can't stand miscounting one grain of sand on their huge beach are a much better choice for who needs to do a tiny bit of extra work

Yes, that's the current state of play. I hope you pointed that out to the people who complained about the output of the snippet you provided.
And I'm sure they were quite happy to do that extra work.

Cheers,
Rob

In reply to Re^5: Variables are automatically rounded off in perl (audiences) by syphilis
in thread Variables are automatically rounded off in perl by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.