Adobe ColdFusion 8

ACos

Description

Arccosine function. The arccosine is the angle whose cosine is number.

Returns

The arccosine, in radians, of a number.

Category

Mathematical functions

Function syntax

ACos(number)

See also

Cos, Sin, ASin, Tan, Atn, Pi

Parameters

Parameter

Description

number

Cosine of an angle. The value must be between -1.0 and 1.0, inclusive.

Usage

The range of the result is 0 to p.

To convert degrees to radians, multiply degrees by p/180. To convert radians to degrees, multiply radians by 180/p.

Example

<h3>ACos Example</h3>
<!--- Output the arccosine value. --->
<cfif IsDefined("FORM.CosNum")>
    <cfif IsNumeric(FORM.CosNum)>
        <cfif Abs(FORM.CosNum) LESS THAN OR EQUAL TO 1>
            <cfoutput>ACos(#FORM.CosNum#) = #ACos(FORM.cosNum)# Radians     </cfoutput>
            <br>or<br>
            <cfoutput>ACos(#FORM.CosNum#) = #ACos(FORM.cosNum) * 180/PI()#</cfoutput>
        <cfelse>
            <!--- If it is empty, output an error message. --->
            <h4>Enter a number between -1 and 1</h4>
        </cfif>
    </cfif>        
</cfif>

<form method="post" action = "acos.cfm">
    <p>Enter a number to get its arccosine in Radians and Degrees.
    <br><input type = "Text" name = "cosNum" size = "25">
    <p><input type = "Submit" name = ""> <input type = "RESET">
</form>