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
Errortype,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 differentStringrepresentations - Added implementation of
IExternalizable - Removed
format(); it or something like it may later come back to allow performantBigDecimalformatting - Removed
formprivate variable; numbers are now form-agnostic - Changed constructor's handling of
Numberparameters: it no longer sets the scale to 10. You should useString/intarguments instead ofNumberat 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,9999to-2,147,483,648 .. 2,147,483,647(int.MIN_VALUE .. int.MAX_VALUE) - Changed some methods to throw
ArithmeticErrorand/orArgumentErrorinstead of plainError - Changed
pow()'s exponent argument fromBigDecimaltoint - Changed internal storage of mantissa digits from
ArraytoVector.<int> - Changed from using AS3 code to create, extend and copy
Arraysto use nativeVectormethods instead
MathContext.as
- Removed property-shadowing
getXxx()methods; use the property-named getters instead - Removed
formproperty andNOTATION_PLAIN,NOTATION_SCIENTIFICandNOTATION_ENGINEERINGconstants
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