CFLib.org – Common Function Library Project

Hypotenuse(x, y)

Last updated July 18, 2001

author

Joel Cox

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Returns the hypotenuse of a right triangle by Pythagorean theorem, given the lengths of the other two sides.

Return Values:
Returns a simple value.

Example:

<CFSET x=3>
  <CFSET y=4>
  <CFOUTPUT>
  Given:
  <UL>
  <LI>x = 3
  <LI>y = 4
  </UL>
  The length of the hypotenuse = #Hypotenuse(x, y)#
  </CFOUTPUT>

Parameters:

Name Description Required
x Length of one side adjacent to the right angle Yes
y Length of the other side adjacent to the right angle Yes

Full UDF Source:

/**
 * Returns the hypotenuse of a right triangle by Pythagorean theorem, given the lengths of the other two sides.
 * 
 * @param x                 Length of one side adjacent to the right angle 
 * @param y                 Length of the other side adjacent to the right angle 
 * @return Returns a simple value. 
 * @author Joel Cox (jlcox@goodyear.com) 
 * @version 1.0, July 18, 2001 
 */
function Hypotenuse(x,y)
{
    Return(Sqr(x^2 + y^2));
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson