Commit 0bd0be37 authored by Cédric Traizet's avatar Cédric Traizet

BUG: compare floating point with an epsilon instead of 0.0, as it is not safe

parent 01b3e6c6
Pipeline #4261 passed with stages
in 75 minutes
......@@ -45,7 +45,7 @@ TOutput ComputeSpectralAngle(TInput const & input, typename TInput ::ValueType c
auto minSize = std::min(input.Size(), reference.Size());
double scalarProduct = std::inner_product(&input[0], &input[minSize], &reference[0],0. );
auto normProd = inputNorm * refNorm;
if ((normProd == 0.0) || (scalarProduct / normProd > 1))
if ((normProd < 1.e-12) || (scalarProduct / normProd > 1))
{
return static_cast<TOutput>(0.0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment