Math.hypot
Math.hypot
Function
hypotenuse length. Returns the length of the hypotenuse of sqrt(x x + y y).
Syntax
Math.hypot(x, y)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| x | Number | Yes | None | Right side x. |
| y | Number | Yes | None | Right angle side y. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the length of the hypotenuse of sqrt(x x + y y). An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.hypot(3, 4) // Output: 5 print result
Notes
- Internally uses Rust f64's hypot operation.