FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.

# `Hypot`

 This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.
``Hypot( a, b )``
``hypot( a, b )``
``Hypot( a, b )``
``Hypot( a, b )``
``Hypot( a, b )``

## Description

The `Hypot` function calculates the length of the hypotenuse of a right-angle triangle, given the length of the other two sides.

## Parameters

Parameter Type Definition and Requirements

`a`

Number

The length of one side of the right triangle.

`b`

Number

Optional - The length of the second side of the right triangle. If this argument is not provided, the operation assumes an isosceles right triangle, where `b` is equal to `a`.

## Returns

A number which is the length of the hypotenuse of a right triangle.

## Examples

The following query executes an array of independent hypotenuse calculations and returns the results in an array. The result array position matches the execution array position. The first operation takes the value 3.0 for the length of both sides of the right triangle (i.e., an isosceles right triangle) and returns the length of the hypotenuse. The result 4.242640687119285 is in the top position of the execution array. The second operation calculates the hypotenuse length using side lengths of 3 and 4. The resulting hypotenuse length of 5.0 is placed in the second position of the execution array.

``````client.query(
[
q.Hypot(3.0),
q.Hypot(3, 4),
q.Hypot(3.5, 5.5),
]
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
'Error: [%s] %s: %s',
err.name,
err.message,
err.errors()[0].description,
))``````
``[ 4.242640687119285, 5, 6.519202405202649 ]``
``````try
{
Value result = await client.Query(
Arr(
Hypot(3.0),
Hypot(3, 4),
Hypot(3.5, 5.5)
)
);

Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine(\$"ERROR: {e.Message}");
}``````
``[4.242640687119285, 5, 6.519202405202649]``
``````[
Hypot(3.0),
Hypot(3, 4),
Hypot(3.5, 5.5),
]``````
``[ 4.242640687119285, 5, 6.519202405202649 ]``
Query metrics:
•    bytesIn:  53

•   bytesOut:  54

• computeOps:   1

•   writeOps:   0