Skip to content

Commit

Permalink
Circumvent persistent FPE for vectorized sqrt
Browse files Browse the repository at this point in the history
  • Loading branch information
jppelteret committed Jun 12, 2022
1 parent 391dd74 commit 351d069
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/weak_forms/unary_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,10 @@ private: \
{
using namespace std;

// Circumvent persistent FPE
if (value == vectorized_value_type<ScalarType, width>{})
return vectorized_value_type<ScalarType, width>{};

#ifdef WEAK_FORMS_VECTORIZATION_FPE_SQRT_OF_ZERO
// We need to check if the vector is a zero vector. If so, simply
// avoid the operation that would result in an FPE as we know the
Expand Down

0 comments on commit 351d069

Please sign in to comment.