update {cs/cpp}/equality-on-floats to use the same alert-message/description

This commit is contained in:
erik-krogh
2022-08-11 15:43:46 +02:00
parent 55c8863e92
commit ea2777fa3e
2 changed files with 4 additions and 2 deletions

View File

@@ -21,4 +21,4 @@ where
FloatingPointType and FloatingPointType and
not ro.getAnOperand().isConstant() and // comparisons to constants generate too many false positives not ro.getAnOperand().isConstant() and // comparisons to constants generate too many false positives
not left.(VariableAccess).getTarget() = right.(VariableAccess).getTarget() // skip self comparison not left.(VariableAccess).getTarget() = right.(VariableAccess).getTarget() // skip self comparison
select ro, "Equality test on floating point values may not behave as expected." select ro, "Equality checks on floating point values can yield unexpected results."

View File

@@ -1,6 +1,8 @@
/** /**
* @name Equality check on floating point values * @name Equality check on floating point values
* @description Equality checks on floating point values can yield unexpected results. * @description Comparing results of floating-point computations with '==' or
* '!=' is likely to yield surprising results since floating-point
* computation does not follow the standard rules of algebra.
* @kind problem * @kind problem
* @problem.severity warning * @problem.severity warning
* @precision medium * @precision medium