Hypot
Not available in this language yet.
Hypot( a, b )
Hypot( a, b )
Hypot( a, b )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
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
Argument | Type | Definition and Requirements |
---|---|---|
|
Number |
The length of one side of the right triangle. |
|
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 |
Examples
The query below 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.
System.out.println(
client.query(
Arr(
Hypot(Value(3.0)),
Hypot(Value(3), Value(4)),
Hypot(Value(3.5), Value(5.5))
)
).get());
client.query([
q.Hypot(3.0),
q.Hypot(3, 4),
q.Hypot(3.5, 5.5),
])
.then((ret) => console.log(ret))
println(Await.result(
client.query(
Arr(
Hypot(3.0),
Hypot(3, 4),
Hypot(3.5, 5.5)
)
),
5.seconds
))
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
[4.242640687119285, 5.0, 6.519202405202649]
[ 4.242640687119285, 5, 6.519202405202649 ]
[4.242640687119285, 5.0, 6.519202405202649]
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!