Description

Calculates the cosine of an angle that is entered in radians.

Returns

A number; the cosine of the angle.

Category

Mathematical functions

Function syntax

Cos(number)

See also

ACosSinASinTanAtnPi

Parameters

Parameter

Description

number

Angle, in radians, for which to calculate the cosine

Usage

The range of the result is -1 to 1. To convert degrees to radians, multiply degrees by p/180. To convert radians to degrees, multiply radians by 180/p.

Note: Because the function uses floating point arithmetic, it returns a small number (such as 6.12323399574E-017) for angles that must produce 0. To test for a 0 value, check whether the value is less than 0.0000000000001.

Example

<cfscript>
    val=0.5
    writeOutput(cos(val))
</cfscript>

Output

0.82533561491

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy