Click or drag to resize

Cos Function

X#
Calculate the cosine of a number.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION Cos(
	nNum AS USUAL
) AS FLOAT
Request Example View Source

Parameters

nNum
Type: Usual
An angle in radians.

Return Value

Type: Float
The cosine of the specified angle.
Remarks
Examples
This example uses Cos() to calculate the cosine of 0 and PI:
X#
1? Cos(0)                //  1.00
2? Cos(PI)                    // -1.00
This example finds the cosine of a 60-degree angle.
The first step is to convert 60 degrees to radians.
This is done by dividing the angle by 180/PI:
X#
1? Cos(60/(180/PI))        //  0.50
See Also