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