[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

@@ -291,7 +291,7 @@ public class Joystick extends GenericHID {
* @return The magnitude of the direction vector
*/
public double getMagnitude() {
return Math.sqrt(Math.pow(getX(), 2) + Math.pow(getY(), 2));
return Math.hypot(getX(), getY());
}
/**