Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^10: Why am I losing accuracy?by bliako (Monsignor) |
on Jan 12, 2020 at 19:47 UTC ( [id://11111343]=note: 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 Section
Seekers of Perl Wisdom
|
|