# 'equals()' called on 'BigDecimal'

Reports `equals()`

calls that compare two `java.math.BigDecimal`

numbers. This is normally a mistake, as two `java.math.BigDecimal`

numbers are only equal if they are equal in both value and scale.

**Example:**

if (new BigDecimal("2.0").equals(
new BigDecimal("2.00"))) {} // false

After the quick-fix is applied:

if (new BigDecimal("2.0").compareTo(
new BigDecimal("2.00")) == 0) {} // true

Inspection Details | |
---|---|

By default bundled with: | |

Can be installed with plugin: | Java, 241.16690 |

Last modified: 29 April 2024