StrictMath.hypot(): This method is available in java.lang.StrictMath class of Java.
Syntax:
double java.lang.StrictMath.hypot(double x, double y)
This method takes two arguments of type double as its parameters. This method returns sqrt(x^2 +y^2) without intermediate overflow or underflow.
Special cases:
1. If either argument is infinite, then the result is positive infinity.
2. If either argument is NaN and neither argument is infinite, then the result is NaN.
Parameters: Two parameters are required for this method.
x: a value.
y: a value.
Returns: sqrt(x2 +y2) without intermediate overflow or underflow.
Exceptions: NA
Approach
Java
public class StrictMathhypot {public static void main(String[] args) {double x = 8, y = 6;System.out.println(StrictMath.hypot(x, y));}}
Output:
10.0
No comments:
Post a Comment