Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

yes, for me the sign of precision is confusing.

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.

What perl -Mbignum=p,1 -wle '$i = 1; print $i + 123456788,"\n"' does is round((1+123456788)/10) * 10 =  123456790 Why? Just add the numbers please? At least when the "width" of the largest can accommodate the result too. Instead it discards the LS"D" of the result and replaces it with a zero. The more increasing p the more LS"D"s are thrown away but the width of the result is not getting any smaller, so what's the practical reason?

From roboticus home node I clicked on dominus home node and then on to his blog which happens to talk about bc just a few days ago. And points out that bc adding two numbers increases the number of digits to accommodate the result. Well bignum does that and then replaces "p" LS"D"s with zeros. thanks.

edit: LS"D" = least significant digit


In reply to Re^10: Why am I losing accuracy? by bliako
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found