Sunday, September 1, 2013

Financial figures? BigDecimal, yes it is!!

If you have to show high value financial figures BigDecimal should be the right type to use.

Float and Double would not show the correct value even if there is no decimal part to it because of the nature of their storage. Yes, BigDecimal is little expensive than Float or Double but you would not mess with financial figures.

e.g.

"342345345"

Float.valueOf("342345345") = 342345344


No comments: