diff --git a/wpimath/src/main/native/include/frc/geometry/Rotation2d.inc b/wpimath/src/main/native/include/frc/geometry/Rotation2d.inc index eb31ebded6..dbe9e3596e 100644 --- a/wpimath/src/main/native/include/frc/geometry/Rotation2d.inc +++ b/wpimath/src/main/native/include/frc/geometry/Rotation2d.inc @@ -23,7 +23,8 @@ constexpr Rotation2d::Rotation2d(units::degree_t value) : Rotation2d(units::radian_t{value}) {} constexpr Rotation2d::Rotation2d(double x, double y) { - const auto magnitude = gcem::hypot(x, y); + double magnitude = + std::is_constant_evaluated() ? gcem::hypot(x, y) : std::hypot(x, y); if (magnitude > 1e-6) { m_sin = y / magnitude; m_cos = x / magnitude;