Java Math.hypot() method

The java.lang.Math.hypot() is used to return the square root of the sum of squares of the specified arguments without intermediate overflow or underflow.

Syntax

Parameter

Return

It returns the sqrt(x2 + y2) without intermediate overflow or underflow.
  • If the arguments are positive or Negative value, this method will return the Output.
  • If either of the argument is positive or negative Infinity, this method will return Positive Infinity.
  • If the arguments are NaN and neither argument is infinite, this method will return NaN.

Example 1

Test it Now

Output:

10.0

Example 2

Test it Now

Output:

5.0

Example 3

Test it Now

Output:

Infinity

Example 4

Test it Now

Output:

NaN

Next TopicJava Math




Latest Courses