ACos

Description

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

Return value

The arccosine of a number, in radians.

Category

Mathematical functions

Syntax

ACos(number) 

See also

Cos, Sin, ASin, Tan, 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 π.

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

Example

<h3>ACos Example</h3>
<!--- output its arccosine value --->
<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>) = 
        <cfoutput>#Evaluate(ACos(FORM.cosNum) * 180/PI())# Degrees</cfoutput>
      <cfelse>
        <!--- if it is empty, output an error message --->
        <h4>Enter a number between -1 and 1</h4>
        </cfif>
    <cfelse>
      <!--- if it is empty, output an error message --->
      <h4>Enter a number between -1 and 1</h4>
    </cfif>
  </cfif>    
</cfif>

<form 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>

Comments