_HYPOT

From QB64 Wiki
Revision as of 23:15, 20 August 2017 by imported>SMcNeill (Created page with '{{DISPLAYTITLE:_HYPOT}} The '''_HYPOT''' function returns the hypotenuse of a right-angled triangle whose legs are x and y. {{PageSyntax}} ::: result! = '''_HYPOT(''' ''y'', ''…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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


Syntax

result! = _HYPOT( y, x)


Parameters

  • x and y are the floating point values corresponding to the legs of a right-angled 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), but without incurring in undue overflow or underflow of intermediate values.


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



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page