How to deal with Number precision in Actionscript?

后端 未结 14 1248
自闭症患者
自闭症患者 2020-11-29 03:23

I have BigDecimal objects serialized with BlazeDS to Actionscript. Once they hit Actionscript as Number objects, they have values like:

140475.32 turns

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 04:23

    You may vote and watch the enhancement request in the Flash PLayer Jira bug tracking system at https://bugs.adobe.com/jira/browse/FP-3315

    And meanwhile use the Number.toFixed() work-around see : (http://livedocs.adobe.com/flex/3/langref/Number.html#toFixed%28%29)

    or use the open source implementations out there : (http://code.google.com/p/bigdecimal/) or (http://www.fxcomps.com/money.html)

    As for the serialization efforts, well, it will be small if you use Blazeds or LCDS as they do support Java BigDecimal serialization (to String) cf. (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=serialize_data_3.html)

提交回复
热议问题