mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Joystick.getMagnitude(): use hypot() function (#4816)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user