Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

As mentioned in one of the comments on your original question, this issue has been covered on StackExchange: http://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-apphttps://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-app

Basically, floating point types should never be used to represent currencies, and like most languages Java has a more appropriate type. Oracle's own documentation on primitives suggests using BigDecimal.

As mentioned in one of the comments on your original question, this issue has been covered on StackExchange: http://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-app

Basically, floating point types should never be used to represent currencies, and like most languages Java has a more appropriate type. Oracle's own documentation on primitives suggests using BigDecimal.

As mentioned in one of the comments on your original question, this issue has been covered on StackExchange: https://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-app

Basically, floating point types should never be used to represent currencies, and like most languages Java has a more appropriate type. Oracle's own documentation on primitives suggests using BigDecimal.

Source Link
FlintZA
  • 293
  • 1
  • 5

As mentioned in one of the comments on your original question, this issue has been covered on StackExchange: http://stackoverflow.com/questions/8148684/what-is-the-best-data-type-to-use-for-money-in-java-app

Basically, floating point types should never be used to represent currencies, and like most languages Java has a more appropriate type. Oracle's own documentation on primitives suggests using BigDecimal.