Floating point numbers pitfall in Java

One very bad programming technique is to use floating point numbers to represent monetary values. In general, floating point is bad for precise values. It's particularly bad for decimal fractions, because common values (such as 0.1) do not have a binary representation.
The correct type to use for currency values is java.math.BigDecimal.

Comments

Popular posts from this blog

How to get Active Transactions and Locks from MySQL

Example of a PAC file