|
|
|
|
|
by janzer
5004 days ago
|
|
And 80x is apparently actually an understatement, at least for a few cases. Some numbers recently posted to python-dev show up to a 124X improvement: Precision: 9 decimal digits
float:
result: 3.1415926535897927
time: 0.113188s
cdecimal:
result: 3.14159265
time: 0.158313s
decimal:
result: 3.14159265
time: 18.671457s
Precision: 19 decimal digits
float:
result: 3.1415926535897927
time: 0.112874s
cdecimal:
result: 3.141592653589793236
time: 0.348100s
decimal:
result: 3.141592653589793236
time: 43.241220s
|
|
Pi is 3.14159 26535 89793 238....
So I do wonder what rounding they are using, even truncating as I have (next digit 4 so good place to do that) then can see the last digit should at least be 8, worst case 7 and 6!! There again this may be a convention or result of the methord to calulate Pi.
As for floats, well, for accuracy I'd go with cdecimal right there, though is it as accurate. I suspect it is the formular used that induces the minute error in results.
http://en.wikipedia.org/wiki/Pi #21 reference