intertwingly

It’s just data

Decimal in ECMAScript


10

Monetary units around the world are often expressed in terms of decimal numbers.  You would think that by this time computers would be adept at handling such, but as this page indicates, sadly such is not the case for JavaScript today.  This befuddles businessmen and causes application developers to focus attention on unnecessary details unrelated to solving the problem at hand.

One of my tasks is to write the spec text for future revisions of ECMAScript to address this by introducing a notion of a Decimal class.  As currently envisioned, this will be accomplished in three layers:

One thing standards bodies often value is independent implementations.  Accordingly, I plan to integrate the decNumber library into the Mozilla codebase.  The decNumber library is made available under a very liberal license and will do all the heavy lifting, all I will need to focus on is a bit of glue code.

Since the last time I looked at the Mozilla codebase, it has moved from CVS to Mercurial.  I’ve managed to check out both Mozilla central and a jsuni branch, and build firefox from source.  The jsuni branch proports to reenable the ability to build a standalone js executable, but at the moment this does not appear to be the case.

If anybody has any pointers on how to build a standalone js executable and how to trigger the execution of the unit tests, I would appreciate it.  I’m sure it is a simple matter of RTFM, if I can only find the right M.