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
P.times() carry problem #125
Comments
Without meticulously studying this time-tested algorithm I wrote years ago, I cannot be sure if it is safe to replace Will |
I mean that if c[j] != 0, then
Yes, I think that c[j] will always be zero at that point and b always be equal to b % 10. Thank you! |
You just "think" or are you absolutely 100% sure? Unfortunately, I am not able to study this closely at the moment. |
I am absolutely 100% sure that c[j] will always be zero at that point and b always be equal to b % 10. |
Okay, I will accept a pull request with this change, if you so wish. I sure hope you know what you are doing. |
Seems like would be good to include a test case that goes from red to green by this. |
This wasn't a bug, just a minor optimisation. BTW I was speaking tongue-in-cheek when I wrote "I sure hope you know what you are doing" above. |
big.js line 848
If there is a carry here, then you have not processed the carry.
If there is no carry I think the following is better.
I don't think there will be a carry in here.
So if I replace
c[j] = (c[j] + b) % 10;
withc[j] = b;
, will there be any problem here?Thank you!
The text was updated successfully, but these errors were encountered: