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

Wrong handling of i (imaginary unit) #281

Closed
gcollura opened this Issue Feb 17, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@gcollura

gcollura commented Feb 17, 2015

Hello, I'm from the team who develops ubuntu-calculator-app for the Ubuntu Phone.
I've encountered a bug with the imaginary unit with your library. If you try to calculate the power of i (i^2) the returned value is not -1, while the definition of i states that _i_² = -1, mathjs returns -1 + 1.2246467991474e-16i.
The issue is also reproduced in this pad http://jsbin.com/fotuxuzuvo/1/edit?html,output
Thanks a lot for your support!

Giulio

@josdejong josdejong added the bug label Feb 17, 2015

@josdejong

This comment has been minimized.

Owner

josdejong commented Feb 17, 2015

He, is the Ubuntu Touch Calculator using mathjs? That's awesome :).

Good point. I've improved the formatting of complex numbers (see commit c29f332), the real or imaginary part is now rounded to zero when the difference is larger than the configured precision. That should solve (read: hide) these kind of numeric round-off errors.

This should be fixed now in the develop branch.

@josdejong josdejong closed this in c29f332 Feb 28, 2015

@rpadovani

This comment has been minimized.

rpadovani commented Mar 2, 2015

Thanks for the fast fix :-)

I updated mathjs in the ubuntu calculator app.

FYI the calculator that is shipped atm on ubuntu phones doesn't use mathjs: we're working on a new version, developed from scratch, that uses mathjs.

This new version will substitute the actual version in next weeks: we hope to push it as update before the end of March, with the firsts sold phones.

Thanks for your amazing work!

@josdejong

This comment has been minimized.

Owner

josdejong commented Mar 2, 2015

Cool. I'm really curious to see the Ubuntu phone in action, same with Firefox OS. Two promising new open source initiatives in a heavily competitive market.

Good luck with the calculator!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment