Macromedia coldfusion 4.5-cfml language reference User Manual
252
CFML Language Reference
ACos
Returns the arccosine of a number in radians. The arccosine is the angle whose cosine
is number.
is number.
See also
Cos
,
Sin
,
ASin
,
Tan,
and
Pi
.
Syntax
ACos(
number)
number
Cosine of the angle that is to be calculated. This value must be between -1 and 1,
inclusive.
inclusive.
Usage
The range of the result is 0 to
π
.
To convert degrees to radians, multiply degrees by
π
/180. To convert radians to
degrees, multiply radians by 180/
π
.
Examples
<!--- This example shows how to use ACos --->
<HTML>
<HEAD>
<TITLE>ACos Example</TITLE>
</HEAD>
<TITLE>ACos Example</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>ACos Example</H3>
<!--- output its arccosine value --->
<CFIF IsDefined("FORM.CosNum")>
<CFIF IsDefined("FORM.CosNum")>
<CFIF IsNumeric(FORM.CosNum)>
<CFIF FORM.CosNum LESS THAN OR EQUAL TO 1>
<CFIF FORM.CosNum GREATER THAN OR EQUAL TO -1>
ACos(<CFOUTPUT>#FORM.CosNum#</CFOUTPUT>) =
<CFOUTPUT>#ACos(FORM.cosNum)# Radians</CFOUTPUT>
<BR>
or
<BR>
ACos(<CFOUTPUT>#FORM.CosNum#</CFOUTPUT>) =
or
<BR>
ACos(<CFOUTPUT>#FORM.CosNum#</CFOUTPUT>) =
<CFOUTPUT>#Evaluate(ACos(FORM.cosNum) * 180/PI())# Degrees</CFOUTPUT>
<CFELSE>
<!--- if it is empty, output an error message --->
<H4>Please enter a number between -1 and 1</H4>
</CFIF>
</CFIF>
<CFELSE>
<!--- if it is empty, output an error message --->
<H4>Please enter a number between -1 and 1</H4>
</CFIF>
</CFIF>
</CFIF>