CFX_FUNCTIONS
by Tom Nunamaker
Many functions that are part of more traditional programming languages are not included as part of the Cold Fusion language. The functions I've wrapped together in this DLL are mostly trigometric functions; however, some standard math functions are also included. Trig functions use RADIANS and NOT DEGREES. If you need to convert back and forth, RadtoDeg and DegToRad are included but the formula is pretty easy to code yourself.
NOTE: I do NO error checking in this release. I simply pass your variables to the native DELPHI functions. It is YOUR responsibily to make sure the values are in a valid range for the particular function.
Syntax
<CFX_FUNCTIONS Function="Value" [, FunctionSecondPart="value" ]>
Returned values are stored in a variable called "results".
Functions
- acosh
- Description: Returns the hyperbolic cosine of X
- Example <CFX_FUNCTIONS acosh="1.6">
<cfoutput>#result#</cfoutput> would output 1.04696791500319
- asinh
- Description: Returns the inverse hyperbolic sine
- Example <CFX_FUNCTIONS asinh="1.6">
<cfoutput>#result#</cfoutput> would output 1.24898332790488
- atan2(X,Y)
- Description: ArcTan(Y/X), and returns an angle in the correct quadrant. The values of X and Y must be between -264 and 264. In addition, the value of X can’t be 0. The return value will fall in the range from -Pi to Pi radians.
- Example <CFX_FUNCTIONS atan2x="4" atan2y="5">
<cfoutput>#result#</cfoutput> would output 0.674740942223553
- atanh
- Description: Returns the inverse hyperbolic tangent of X. The number must be between -1 and 1 (inclusive).
- Example <CFX_FUNCTIONS atanh=".6">
<cfoutput>#result#</cfoutput> would output 0.693147180559945
- cosh
- Description: Returns the hyperbolic cosine
- Example <CFX_FUNCTIONS cosh="0.4">
<cfoutput>#result#</cfoutput> would output 1.08107237183845
- cotan
- Description: Returns the cotangent of X. The cotangent is calculated using the formula
1 / Tan(X)
- Example <CFX_FUNCTIONS cotan="4">
<cfoutput>#result#</cfoutput> would output 0.863691154450617
- degtorad
- Description: Converts angles expressed in degrees to the corresponding value in radians, where
radians = degrees(pi/180).
- Example <CFX_FUNCTIONS degtorad="90">
<cfoutput>#result#</cfoutput> would output 1.5707963267949
- floor
- Description: Call Floor to obtain the highest integer less than or equal to X. For example:
Floor(-2.8) = -3
Floor(2.8) = 2
Floor(-1.0) = -1.
- Example <CFX_FUNCTIONS floor="2.8">
<cfoutput>#result#</cfoutput> would output 2
- hypot(X,Y)
- Description: The Hypot function returns the length of the hypotenuse of a triangle. Specify the lengths of the sides adjacent to the right angle in X and Y. Hypot uses the formula
Sqrt(X**2 + Y**2)
- Example: <CFX_FUNCTIONS hypotx="3" hypoty="4">
<cfoutput>#result#</cfoutput> would output 5
- ldexp(X,Y)
- Description: returns X times (2 to the power of Y)
- Example <CFX_FUNCTIONS ldexpx="5" ldexpy="2">
<cfoutput>#result#</cfoutput> would output 5 X 2**2 = 20
- log2
- Description: returns the log base 2 of the number
- Example <CFX_FUNCTIONS log2="12">
<cfoutput>#result#</cfoutput> would output 3.58496250072116
- radtodeg
- Description: ConvertS angles measured in radians to degrees, where
degrees = radians(180/pi).
- Example <CFX_FUNCTIONS radtodeg="1.5">
<cfoutput>#result#</cfoutput> would output 85.9436692696235
- tanh
- Description: Returns the hyperbolic tangent
- Example <CFX_FUNCTIONS tanh=".7">
<cfoutput>#result#</cfoutput> would output 0.604367777117163
Please send me comments, suggestions, requests for more functions, etc. to tom@nunamaker.com
Copyright © 1999, Tom Nunamaker. All rights reserved.