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:
- The first layer provides a constructor for Decimal with a string argument, and a number of class ("static") methods modeled after the decFloats module in the decNumber library, and a bare minimum of instance methods, such as
- The second layer provides a number of convenience methods inspired by Java’s BigDecimal class.
- The third layer introduces decimal literals (e.g.
1.2m, and no, I don’t know what
mstands for) and infix operators.
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.