Monday, 27 April 2009

Flex in finance

Recently I’ve been taking a break from C# and Winforms and have been having a look at Actionscript and Flex. Looking through Flex livedocs I noticed this paragraph on their description of the Flex “Number” data type.
“Although this range of numbers is enormous, the cost of this range is precision. The Number data type uses 52 bits to store the significand, with the result that numbers that require more than 52 bits to represent precisely, such as the fraction 1/3, are only approximations. If your application requires absolute precision with decimal numbers, you need to use software that implements decimal floating-point arithmetic as opposed to binary floating-point arithmetic.”
Seems to me they’re basically saying that if you have an app where number precision is important, then don’t use Flex. While Flex can create some great looking applications, my impressions are that for financial and LOB applications – Silverlight with the pedigree of C# and the wide range of 3rd party controls and tools should be the first choice.
Update: I’ve just found a 3rd party library with a simplified implementation of the decimal data type. Naturally Flex is extensible, so it’s possible to solve most problems one way or another. However it’s nicer to have an out of the box solution where things like this are present without you having to even think about it. Moreover I tested the performance of this library and found "divide" to be 3000 times slower than float divide, and "multiply" to be 650 times slower than float multiply.