![]() |
|
|
#56 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
24·3·43 Posts |
Took me days to pinpoint my script's bug to Pari GP's rounding error:
With deafault precision I get: Code:
? 100-99.99 %2 = 0.010000000000000000000000000000000000181 Any advice to resolve it will be greatly appreciated. Thank you in advance. Last fiddled with by a1call on 2016-04-20 at 20:04 |
|
|
|
|
|
#57 | |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
Quote:
|
|
|
|
|
|
|
#58 | |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
24·3·43 Posts |
Quote:
Wolfram Alpha shows a similar "mouse-over/hover" error, but then gives the correct answer once the enter is pressed. |
|
|
|
|
|
|
#59 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
81016 Posts |
inconsistent rounding up & down,
makes it much more difficult to deal with: Code:
? 100-99.999 %2 = 0.00099999999999999999999999999999999994282 |
|
|
|
|
|
#60 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
|
|
|
|
|
|
#61 | |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
24·3·43 Posts |
Quote:
What works is truncating the lower digits by rounding, but i have to keep track of significant digits which is inconvenient (figuring out extra code).
Last fiddled with by a1call on 2016-04-20 at 21:54 |
|
|
|
|
|
|
#62 | |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
Quote:
|
|
|
|
|
|
|
#63 | |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
2×67×73 Posts |
Quote:
You don't understand how floating point numbers are represented on digital systems? |
|
|
|
|
|
|
#64 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
a1call, you are definitely in need of reading (e.g.) this page: https://docs.python.org/3.5/tutorial/floatingpoint.html (and possibly sm88 too?)
|
|
|
|
|
|
#65 | |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
24·3·43 Posts |
Quote:
I essentially did this: 100-99.99 =100/100(100-99.99) = (10000-9999)/100 The error seems to be related to the Pari-GP keeping track of the number as much as possible in a/b form and only expanding to decimal point form when needed such as in sums. Last fiddled with by a1call on 2016-04-20 at 22:12 |
|
|
|
|
|
|
#66 |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
2·67·73 Posts |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| An equivalent problem for factorization of large numbers | HellGauss | Math | 5 | 2012-04-12 14:01 |
| PIV Effective Equivalent curiosities... | petrw1 | Software | 0 | 2009-12-05 04:41 |
| Dual Core P95 64Bit P4 Equivalent problem | g0ods | Software | 9 | 2009-09-15 14:12 |
| Is there a finite-field equivalent to the DWT? | fivemack | Math | 4 | 2008-03-27 17:58 |
| Equivalent code | dsouza123 | Programming | 25 | 2005-10-08 05:10 |