Firefox OS – A simple No Nonsense Calculator

When I received my Geeksphone Keon last year (2013), I searched the Firefox Marketplace for a simple calculator, similar to the Calculator that comes with Windows. At the time I couldn’t find anything I liked so I wrote my own, which I named NNCalc, short for No Nonsense Calculator.

One of the things I noticed with many of the calculators on the Firefox Marketplace was that they were not entirely accurate due to normal floating point rounding issues. One way to find out if a calculator has the rounding problem is by doing a couple of simple multiplications where the rounding issues may become apparent. For instance if 0.2 * 6 = 1.2000000000000002 instead of 1.2, or 1.2 * 6 = 7.199999999999999 instead of 7.2 then obviously the calculator has the rounding error.

In order to overcome this rounding issue for my calculator, I used the MikeMcl bignumber.js library.

Leave a Reply

Your email address will not be published. Required fields are marked *