"Infinite precision is not needed"

Yes, that's the point I was making.

    "I don't remember the last time I owed π dollars to someone"

Well, you did say "you can store any number"  :-)

But even if we do limit the calculations to strictly financial ones, it's very easy to demonstrate a case where you'll get round-off.

Assume you have invested $1000, and your average annual interest rate is exactly 4%.  According to the The Rule of 72, you can expect your money to double in approximately (72 / 4) = 18 years.

The problem is, this isn't exact.  The exact period after which your money will double is given by the formula ln 2 / ln 1.04, which is approximately 17.67298769 years.  But my point is, no module is going to give you 100% accuracy for that, because ln 2 and ln 1.04, as well as their quotient, are all transcendental numbers, which means you can't represent them 100% accurately.  Which is all I was trying to get across.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re^5: Decimal Arithmetic by liverpole
in thread Decimal Arithmetic by gcoates

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.