Skip to content
Snippets Groups Projects
Commit 0bd0be37 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

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

parent 01b3e6c6
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment