Good idea, but we need to do some testing.  The problem with floating point is precision.  In our case, we'd really like to use fixed point, but JavaScript doesn't have a native type for that, so the common solution is to use integers, though this would definitely be better wrapped up in a class.  As an example of precision problems, try typing this into the JavaScript console:
    0.01.toFixed(20)
The bits added on the end are due to 0.01 (in decimal) not being perfectly representable in binary floating point.  These errors can accumulate and possibly make the final answer incorrect, although my quick tests indicate that JavaScript is somehow a little smarter about it than C/C++.  Maybe something like http://josscrowcroft.github.io/accounting.js/ can help us out here.  Anyway, let's look into it more, but in the meantime your changes will probably get us a little closer.