[flexcoders] decimal numbers in financial applications

2006-08-16 Thread busitech
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.9199289457264239899814128875732421875 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 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] decimal numbers in financial applications

2006-08-16 Thread Gordon Smith












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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of busitech
Sent: Wednesday, August 16, 2006
9:06 AM
To: flexcoders@yahoogroups.com
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.9199289457264239899814128875732421875 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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___