Skip to content

Commit

Permalink
Fix complex math pow test (#2336)
Browse files Browse the repository at this point in the history
Increase the margin for results comparisn for single precision floating
point operations due to high computing error compared to `std::pow`.
  • Loading branch information
psychocoderHPC authored Aug 3, 2024
1 parent 4995c5b commit dbc5ebe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/unit/math/src/TestTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ namespace mathtest
if(!isFinite(a) && !isFinite(b))
return true;
// For the same reason use relative difference comparison with a large margin
auto const scalingFactor = static_cast<T>(std::is_same_v<T, float> ? 1.1e4 : 1.1e6);
auto const scalingFactor = static_cast<T>(std::is_same_v<T, float> ? 1.5e4 : 1.1e6);
auto const marginValue = scalingFactor * std::numeric_limits<T>::epsilon();
return (a.real() == Catch::Approx(b.real()).margin(marginValue).epsilon(marginValue))
&& (a.imag() == Catch::Approx(b.imag()).margin(marginValue).epsilon(marginValue));
Expand Down

0 comments on commit dbc5ebe

Please sign in to comment.