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));
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson