We're considering adding decimal arithmetic to a future release, but I'm afraid that currently neither the player nor the Flex framework offers this. Decimal arithmetic is not a feature of _javascript_ or ECMAScript, the languages that we've based ActionScript on. So I'm curious how developers writing financial web applications in HTML and _javascript_ solve this problem.

 

One way to deal with large numbers is to treat them as Strings and do all decimal arithmetic on the server, but that probably isn't practical for you.

 

Another way might be to use Number to exactly store integral cents rather than fractional dollars. I believe you can store integers up to about 2^52 in a Number.

 

It sounds like the docs are misleading... where exactly did you read about BigDecimal, so I can have the doc team review what they say?

 

- Gordon

 


From: [email protected] [mailto:[email protected]] On Behalf Of busitech
Sent: Wednesday, August 16, 2006 9:06 AM
To: [email protected]
Subject: [flexcoders] decimal numbers in financial applications

 

Dear Group,

Java BigDecimal serialization to and from the Flash client appears
very broken. At best I'd say it's just incomplete. How do those of
you who write financial applications with currency or just simple
applications which need fixed decimal support deal with this?

For example, a number of 1.92 sent to the server in a Number ends up
as 1.9199999999999999289457264239899814128875732421875 in the
BigDecimal on the other end. If my BigDecimal had a scale of 2 the
result is 1.91.

I understand that Number is an IEEE-754 double-precision
floating-point number, which is the problem here.

If Flex is marketed as a piece of business software without good
support for dollars and cents, fixed decimal numbers, accurate
currency, in short - financial data which drives the business!
(Having BigDecimal mentioned in the serialization documentation is so
wrong in my mind with this kind of behavior.)

Is there something I am missing? Is there a way to make this work
correctly? If not, it looks as though I need to port BigDecimal to
Actionscript.

Thank you for your consideration.

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to