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

[QT 5.3]Sometimes division fails on ARM processors #39

Closed
rpadovani opened this issue Jul 2, 2014 · 2 comments
Closed

[QT 5.3]Sometimes division fails on ARM processors #39

rpadovani opened this issue Jul 2, 2014 · 2 comments

Comments

@rpadovani
Copy link

We use this library in the calculator app on Ubuntu Touch.

Under certain conditions (on a Nexus 4/7 with QT 5.3 which is connected via usb to the computer) divisions fails bad (1/3 = 0.3 instead 0.333333, 55/2 = 25). See the original bug to more informations.

We find the bug is caused by timing issue with setting and reading the rem[] array in the do/while cycle in division function.

We fixed in a very symple way, we inverted the adding of next digit to the result array and the update of remainder. See this patch.

Are you interesting to have this change in your code?
I know that is a very specific bug about a certain platform, but can happen also on others platforms.

Hoping to have pleased reporting the bug,
Regards,
Riccardo

@MikeMcl
Copy link
Owner

MikeMcl commented Jul 2, 2014

I'd like to help but the bug does not seem to be in this library so it doesn't seem appropiate to apply the fix here.

Incidentally, you may find decimal.js to be more suited to a calculator application.

@MikeMcl MikeMcl closed this as completed Jul 2, 2014
@rpadovani
Copy link
Author

On Wed, Jul 02, 2014 at 12:04:15PM -0700, Michael M wrote:

I'd like to help but the bug does not seem to be in this library so it doesn't seem appropiate to apply the fix here. Doing so would only serve to hide its real origin whatever that may be.

Yes, I agree with you on that, but I think it's right to let you know :-)

Perhaps you are right when you suggest that "the bug is in the QT 5.3 Javascript Interpreter". If so, I am sure they would appreciate you getting to the bottom of it ;)

I'm working with our team to understand the bug and report it upstream, if
necessary

Incidentally, you may find decimal.js to be more suited to a calculator application.

Thanks for the information, I'll definitely take a look to it!

Regards,

Riccardo Padovani
www.rpadovani.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants