Home >>Java Math Methods >Java Math.hypot() method
The Math.hypot() Method in Java Math is used without intermediate overflow or underflow to return the square root of the sum of squares of the given arguments.
public static double hypot(double x, double y)
x = This method is used for a value
y =This method is used for a value
It is used to returns the sqrt(x2 + y2) without intermediate overflow or underflow.
public class MyClass
{
public static void main(String[] args)
{
double x = 2;
double y = 10;
System.out.println(Math.hypot(x, y));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = -8;
double b = 5;
System.out.println(Math.hypot(a, b));
}
}