2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Add div by 0 check

This commit is contained in:
Matt Borland
2025-09-08 13:33:51 +02:00
parent fb5641a80a
commit 5f15c8f77e

View File

@@ -81,6 +81,12 @@ BOOST_MATH_GPU_ENABLED T hypot_impl(T x, T y, T z, const Policy& pol)
#endif
const T a {(max)((max)(x, y), z)};
if (a == T(0))
{
return a;
}
const T x_div_a {x / a};
const T y_div_a {y / a};
const T z_div_a {z / a};