diff --git a/src/SFML/System/Vector2.cpp b/src/SFML/System/Vector2.cpp index cd2272a2..72183b26 100644 --- a/src/SFML/System/Vector2.cpp +++ b/src/SFML/System/Vector2.cpp @@ -106,8 +106,9 @@ template T Vector2::length() const { static_assert(std::is_floating_point_v, "Vector2::length() is only supported for floating point types"); - - return std::sqrt(x*x + y*y); + + // don't use std::hypot because of slow performance + return std::sqrt(x * x + y * y); } } // namespace sf diff --git a/src/SFML/System/Vector3.cpp b/src/SFML/System/Vector3.cpp index 89cb5106..392a8138 100644 --- a/src/SFML/System/Vector3.cpp +++ b/src/SFML/System/Vector3.cpp @@ -48,7 +48,8 @@ T Vector3::length() const { static_assert(std::is_floating_point_v, "Vector3::length() is only supported for floating point types"); - return std::sqrt(x*x + y*y + z*z); + // don't use std::hypot because of slow performance + return std::sqrt(x * x + y * y + z * z); } } // namespace sf