[wpilib] Joystick.getMagnitude(): use hypot() function (#4816)

This commit is contained in:
Sriman Achanta
2022-12-14 01:29:09 -05:00
committed by GitHub
parent 2a5e89fa97
commit c569d8e523
2 changed files with 2 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ BooleanEvent Joystick::Top(EventLoop* loop) const {
}
double Joystick::GetMagnitude() const {
return std::sqrt(std::pow(GetX(), 2) + std::pow(GetY(), 2));
return std::hypot(GetX(), GetY());
}
double Joystick::GetDirectionRadians() const {