Now with added enterpriseyness!!
This project is a continuation of the de-facto ActionScript3 BigDecimal implementation focusing on
- Correctness
- Performance
- Cleanliness
Initial benchmarks show the current version is 25-50% faster and uses around 30% less memory. See the bench
directory for details.
Here's a summary of the interesting internal and API changes made since http://code.google.com/p/bigdecimal/.
ArithmeticError.as
- Added new
Error
type,ArithmeticError
BigDecimal.as
- Added
createFromUnscaledInteger()
static factory method for when you have an unscaled integer and a separate scale - Added
toEngineeringString()
,toPlainString()
andtoCanonicalString()
methods for differentString
representations - Added implementation of
IExternalizable
- Removed
format()
; it or something like it may later come back to allow performantBigDecimal
formatting - Removed
form
private variable; numbers are now form-agnostic - Changed constructor's handling of
Number
parameters: it no longer sets the scale to 10. You should useString
/int
arguments instead ofNumber
at all times - Changed
scale()
to allow returning negative values; before the return value was always positive - Changed maximum range of integer exponents from
-99,9999,999 .. 99,999,9999
to-2,147,483,648 .. 2,147,483,647
(int.MIN_VALUE .. int.MAX_VALUE
) - Changed some methods to throw
ArithmeticError
and/orArgumentError
instead of plainError
- Changed
pow()
's exponent argument fromBigDecimal
toint
- Changed internal storage of mantissa digits from
Array
toVector.<int>
- Changed from using AS3 code to create, extend and copy
Arrays
to use nativeVector
methods instead
MathContext.as
- Removed property-shadowing
getXxx()
methods; use the property-named getters instead - Removed
form
property andNOTATION_PLAIN
,NOTATION_SCIENTIFIC
andNOTATION_ENGINEERING
constants
Tests
- Added lots of unit tests from the Apache Harmony project; code coverage is currently 87%
In no particular order, the roadmap includes the following, depending on user feedback:
- Provide a fast BigDecimalFormatter, avoiding intermediary String munging
- Benchmark more public methods, eg, add, subtract, multiply, divide, toString, setScale; add pretty charts for benchmark results; Publish bencmark app
- More refactoring/performance tuning