-
Notifications
You must be signed in to change notification settings - Fork 34
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
bc freezes evaluating cbrt(0.01) #64
Comments
Yes, this is a bug. I have reproduced it. Your fix pointed right to the problem, which I suspected: it ran into a pathological case where the two values, This is the reason I hate algorithms that are calculated by series. They can easily have problems like this. I tried to fix it with 01230fc. It increases the precision, but then does the comparison at a smaller precision. Can you pull and test it for me? I'll start my release process in the meantime. |
I tested your solution and it worked! Never mind, you already did it. |
Yes, but you are right that if I did not, I should have! I will put out a release with the fix as soon as I can. I'll close this issue at that time. |
Release |
bin/bc enters an infinite loop while evaluating the cube-root of 0.01
bin/bc -l -e 'cbrt(0.1)'
returns .46415888336127788924 (which is expected)
bin/bc -l -e 'cbrt(0.01)'
freezes
Looking at the definition of root(x,n) in lib2.bc the following loop never exits
A simple hack makes the cbrt function working.
The text was updated successfully, but these errors were encountered: