# Difference between revisions of "HYPOT"

Jump to navigation
Jump to search

imported>SMcNeill |
m (Text replacement - "{{Parameters}}" to "{{PageParameters}}") |
||

(4 intermediate revisions by 3 users not shown) | |||

Line 1: | Line 1: | ||

{{DISPLAYTITLE:_HYPOT}} | {{DISPLAYTITLE:_HYPOT}} | ||

− | The | + | The [[_HYPOT]] function returns the hypotenuse of a right-angled triangle whose legs are x and y. |

{{PageSyntax}} | {{PageSyntax}} | ||

− | : | + | : {{Parameter|result!}} = [[_HYPOT]]({{Parameter|x}}, {{Parameter|y}}) |

− | {{ | + | {{PageParameters}} |

− | * | + | * {{Parameter|x}} and {{Parameter|y}} are the floating point values corresponding to the legs of a right-angled (90 degree) triangle for which the hypotenuse is computed. |

{{PageDescription}} | {{PageDescription}} | ||

− | |||

* The function returns what would be the square root of the sum of the squares of x and y (as per the Pythagorean theorem). | * The function returns what would be the square root of the sum of the squares of x and y (as per the Pythagorean theorem). | ||

+ | * The hypotenuse is the longest side between the two 90 degree angle sides | ||

+ | {{PageExamples}} | ||

''Example:'' | ''Example:'' | ||

{{CodeStart}} '' '' | {{CodeStart}} '' '' | ||

Line 22: | Line 23: | ||

leg_y = 4 | leg_y = 4 | ||

result = {{Cl|_HYPOT}}(leg_x, leg_y) | result = {{Cl|_HYPOT}}(leg_x, leg_y) | ||

− | {{Cl|PRINT}} | + | {{Cl|PRINT}} USING "## , ## and ## form a right-angled triangle."; leg_x; leg_y; result |

{{CodeEnd}} | {{CodeEnd}} | ||

Line 28: | Line 29: | ||

3 , 4 and 5 form a right-angled triangle. | 3 , 4 and 5 form a right-angled triangle. | ||

{{OutputEnd}} | {{OutputEnd}} | ||

+ | |||

{{PageSeeAlso}} | {{PageSeeAlso}} | ||

* [[ATN]] {{text|(arctangent)}} | * [[ATN]] {{text|(arctangent)}} | ||

− | * [[_PI]] {{text|( | + | * [[_PI]] {{text|(function)}} |

* [[Mathematical Operations]] | * [[Mathematical Operations]] | ||

* [http://www.cplusplus.com/reference/cmath/hypot/ C++ reference for hypot() - source of the text and sample above] | * [http://www.cplusplus.com/reference/cmath/hypot/ C++ reference for hypot() - source of the text and sample above] |

## Latest revision as of 12:41, 17 February 2021

The _HYPOT function returns the hypotenuse of a right-angled triangle whose legs are x and y.

## Syntax

*result!*= _HYPOT(*x*,*y*)

## Parameters

*x*and*y*are the floating point values corresponding to the legs of a right-angled (90 degree) triangle for which the hypotenuse is computed.

## Description

- The function returns what would be the square root of the sum of the squares of x and y (as per the Pythagorean theorem).
- The hypotenuse is the longest side between the two 90 degree angle sides

## Examples

*Example:*

* *
DIM leg_x AS DOUBLE, leg_y AS DOUBLE, result AS DOUBLE
leg_x = 3
leg_y = 4
result = _HYPOT(leg_x, leg_y)
PRINT USING "## , ## and ## form a right-angled triangle."; leg_x; leg_y; result

3 , 4 and 5 form a right-angled triangle.

## See also

- ATN (arctangent)
- _PI (function)
- Mathematical Operations
- C++ reference for hypot() - source of the text and sample above

*Navigation:*