in reply to Re^5: Why am I losing accuracy?
in thread Why am I losing accuracy?
The maintainer of bigint replied to filing a bug:
Here is your problem: p=>1 specifies a precision of 1. See these for comparisation: $ perl -Mbignum=p,1 -wle '$i = 1; print $i + 123456788,"\n"' 123456790 $ perl -Mbignum=p,2 -wle '$i = 1; print $i + 123456788,"\n"' 123456800 $ perl -Mbignum=p,5 -wle '$i = 1; print $i + 123456788,"\n"' 123500000 Looks to me it works as designed. Here is the same with different accuracy values: $ perl -Mbignum=a,1 -wle '$i = 1; print $i + 123456788,"\n"' 100000000 $ perl -Mbignum=a,2 -wle '$i = 1; print $i + 123456788,"\n"' 120000000 $ perl -Mbignum=a,3 -wle '$i = 1; print $i + 123456788,"\n"' 123000000 and with negative values of p: $ perl -Mbignum=p,-3 -wle '$i = 1; print $i + 123456789.1,"\n"' 123456790.100 $ perl -Mbignum=p,-6 -wle '$i = 1; print $i + 123456789.1,"\n"' 123456790.100000 Best regards, Tels
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Why am I losing accuracy?
by bliako (Abbot) on Jan 12, 2020 at 11:31 UTC | |
by haukex (Archbishop) on Jan 12, 2020 at 15:08 UTC | |
by roboticus (Chancellor) on Jan 12, 2020 at 15:56 UTC | |
by bliako (Abbot) on Jan 12, 2020 at 19:47 UTC | |
by syphilis (Archbishop) on Jan 13, 2020 at 00:36 UTC | |
|