We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9ee8f8b commit b27886bCopy full SHA for b27886b
Siv3D/include/Siv3D/detail/Point.ipp
@@ -309,13 +309,17 @@ namespace s3d
309
template <class Type>
310
inline Type Point::length() const noexcept
311
{
312
- return static_cast<Type>(std::sqrt((x * x) + (y * y)));
+ const Type x_ = static_cast<Type>(x);
313
+ const Type y_ = static_cast<Type>(y);
314
+ return static_cast<Type>(std::sqrt((x_ * x_) + (y_ * y_)));
315
}
316
317
318
inline constexpr Type Point::lengthSq() const noexcept
319
- return static_cast<Type>((x * x) + (y * y));
320
321
322
+ return ((x_ * x_) + (y_ * y_));
323
324
325
inline constexpr int32 Point::manhattanLength() const noexcept
0 commit comments