From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Global Method

Cos(value As Double) As Double

Supported for all project types and targets.

Returns the cosine of the given angle.


result = Cos (value)

Part Type Description
result Double The cosine of value.
value Double The value (in radians) you want the cosine of.


The Cos function returns the cosine of the angle (in radians) passed to it. If the angle is in degrees, multiply it by PI/180 to convert it to radians.

Sample Code

This code uses the Cos function to return the cosine of an angle.

Var d As Double
Const Pi = 3.14159
d = Cos(45 * Pi / 180) // returns 0.707

See Also

Acos function