What to do with Java BigDecimal performance?

后端 未结 20 2533
陌清茗
陌清茗 2020-11-29 17:28

I write currency trading applications for living, so I have to work with monetary values (it\'s a shame that Java still doesn\'t have decimal float type and has nothing to s

20条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 18:07

    Most double operations give you more than enough precision. You can represent $10 trillion with cent accuracy with double which may be more than enough for you.

    In all the trading systems I have worked on (four different banks), they have used double with appropriate rounding. I don't see any reason to be using BigDecimal.

提交回复
热议问题