
resources.report.rules.findbugs.FE_FLOATING_POINT_EQUALITY.html Maven / Gradle / Ivy
FE: Test for floating point equality (FE_FLOATING_POINT_EQUALITY)
FE: Test for floating point equality (FE_FLOATING_POINT_EQUALITY)
This operation compares two floating point values for equality.
Because floating point calculations may involve rounding,
calculated float and double values may not be accurate.
For values that must be precise, such as monetary values,
consider using a fixed-precision type such as BigDecimal.
For values that need not be precise, consider comparing for equality
within some range, for example:
if ( Math.abs(x - y) < .0000001 )
.
See the Java Language Specification, section 4.2.4.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy