I wish Perl had arbitrary precision integers, and could add/subtract/compare decimal numbers without losing precision.

Decimal floating point is certainly doable... I did it years ago on a Z80. It's not what you'd call cheap, run-time-wise -- though with a 64 bit processor and fast multiply/divide instructions, it's probably a whole lot less painful than it used to be.

If there isn't one already, I'd be amused to do a "DecFlt" equivalent of "BigInt". The first decision is whether to do that as big precision floating point, or indefinite precision fixed point.

From a scientific programming perspective, binary floating point is better than any other radix. IBM machines used to use radix 16, to save time and hardware during normalisation and alignment shifts. Unfortunately, that saving came at the cost of the wonderfully named "wobbling precision". With 24 bits of precision, radix 16 floating point results are good to +/- any one of 2^-24, 2^-23, 2^-22 or 2^-21, depending on the value of the leading base 16 digit !


In reply to Re^5: Getting different results with $var++ and $var += 1 by gone2015
in thread Getting different results with $var++ and $var += 1 by splicer

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.