I am also confused as to what precision and what accuracy mean for bignum and why in incrementing an integer (for example, in the loop) precision discards useful digits to replace them with zeros

When you specify p => 1 you're actually saying that you want the values rounded to the nearest multiple of 10.
To have the values rounded to the nearest multiple of 100, specify p => 2. For rounding to the nearest multiple of 1000, specify p => 3, and so on.
So, with p => 1, 10 + 1 == 10 and 10 + 6 == 20, because 11 rounded to the nearest multiple of 10, is 10 and 16 rounded to the nearest multiple of 10 is 20.

OTOH, a => 1 indicates that you want the value rounded to a value that comprises a single digit multiplied by a power of 10, a => 2 indicates that the value should be rounded to a double-digit value multiplied by a power of 10.
It seems to me that "accuracy" would be better named "precision". (The trailing zeroes are just the exponent - it's the number of leading digits ahead of the exponent that determines the precision of the value.)
Not sure what "precision" should be renamed to .... "accuracy" ?

I think negative values for "p" just tell you how many decimal places you want after the decimal point.

With practice and experience it's probably useful - if you keep your wits about you. (I have not tested this - the reliance on "wits" deters me.)

Cheers,
Rob

In reply to Re^11: Why am I losing accuracy? by syphilis
in thread Why am I losing accuracy? 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.