diff --git a/libs/kimath/src/geometry/seg.cpp b/libs/kimath/src/geometry/seg.cpp index aa18774356..2e5a787407 100644 --- a/libs/kimath/src/geometry/seg.cpp +++ b/libs/kimath/src/geometry/seg.cpp @@ -54,11 +54,14 @@ constexpr T ct_sqrt(T x) return sqrt_helper(x, 0, x / 2 + 1); } +template +static constexpr T sqrt_max_typed = ct_sqrt( std::numeric_limits::max() ); + template T isqrt(T x) { T r = (T) std::sqrt((double) x); - T sqrt_max = ct_sqrt(std::numeric_limits::max()); + T sqrt_max = sqrt_max_typed; while (r < sqrt_max && r * r < x) r++;