Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Arbitrary Precision #5

Open
irperez opened this issue Nov 1, 2012 · 0 comments
Open

Enable Arbitrary Precision #5

irperez opened this issue Nov 1, 2012 · 0 comments
Assignees
Milestone

Comments

@irperez
Copy link
Owner

irperez commented Nov 1, 2012

Arbitrary Precision algorithms is what windows calculator uses to maintain accuracy in its calculations and avoids the floating point inaccuracies and make this an option not the rule.

Making this optional can provide performance when needed or accuracy when its needed.

Arbitrary precision has several algorithms with different pros and cons. I propose we try them all and run tests to see how they would benefit us. Maybe even make it a setting to choose which to use for performance reasons.

Here is the Karatsuba algorithm (pseudo code)
http://en.wikipedia.org/wiki/Karatsuba_algorithm

procedure karatsuba(num1, num2)
if (num1 < 10) or (num2 < 10)
return num1_num2
/_ calculates the size of the numbers /
m = max(size(num1), size(num2))
low1, low2 = lower half of num1, num2
high1, high2 = higher half of num1, num2
/
3 calls made to numbers approximately half the size _/
z0 = karatsuba(low1,low2)
z1 = karatsuba((low1+high1),(low2+high2))
z2 = karatsuba(high1,high2)
return (z2_10^(m))+((z1-z2-z0)*10^(m/2))+(z0)

@ghost ghost assigned irperez Nov 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant