Description
Not sure if this is a FP in the strong sense but the "why is this an issue" text should at least clearly state that the suggested "fix" behaves differently than the original code if a or b is NaN.
public static bool Foo(ReadOnlySpan<double> a, ReadOnlySpan<double> b)
{
for (; i < a.Length; ++i)
{
if (!(a[i] <= b[i])) return false;
}
return true;
}
we have several places in our code base that intentionally invert the result of a floating point comparison. Applying the suggestion to remove the invert would cause bugs.
Obviously the solution on our side is to double check that we have unittests that protect against blind application of the so called fix.
Reproducer
public static bool Foo(ReadOnlySpan<double> a, ReadOnlySpan<double> b)
{
for (; i < a.Length; ++i)
{
if (!(a[i] <= b[i])) return false;
}
return true;
}
Product and Version
Sonarqube server, Data Center Edition v2025.1 (102418)