top of page

BigDecimal in Java

Jonathan

  • If you are dealing with money, or precision is a must, use BigDecimal. Otherwise Doubles tend to be good enough.

  • The disadvantage of BigDecimal is that it's slower, and it's a bit more difficult to program algorithms that way (due to +, -, * and / not being overloaded).

Example:


Result:


12 views
Single post: Blog_Single_Post_Widget
bottom of page