resources.report.rules.findbugs.FE_FLOATING_POINT_EQUALITY.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
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 - 2024 Weber Informatics LLC | Privacy Policy