BigDecimal support for JavaScript
You can download two JavaScript classes here that allow
calculations with nearly arbitrary precision (only dependent
on the available amount of memory). These classes have been
tested with Internet Explorer 5.5, Mozilla 1.3, and Camino 0.7.
The JavaScript classes are an exact conversion of the
MathContext and BigDecimal Java classes
implemented by IBM in the
International Components for Unicode for Java
project. The JavaScript version is available under the same
license
as the orginal Java classes. In short, you may use and distribute
them as you like as long as the copyright notices stay intact.
The download archive contains a
test page that
demonstrates using BigDecimals for calculating the Euler number.
This calculation is relatively slow because of the many divisions
and multiplications that are necessary - additions however, which
are much more common in real world projects, are very fast.
Besides the source code, there is no further documentation (yet).
If you have questions or suggestions, please contact
Andreas Junghans.
Download
|