Skip to main content

cos

Type​

function

Summary​

Returns the cosine of an angle (in radians).

Syntax​

the cos of <angle>
cos(<angle>)

Description​

Use the cos function to find the cosine of an angle.

The cos function repeats every 2 * pi radians: cos(x) = cos(x + 2 * pi), for any value of x.

The cos function requires its input to be in radians. To provide an angle in degrees, use the following custom function:

    function cosInDegrees angleInDegrees
return cos(angleInDegrees * pi / 180)
end cosInDegrees

Parameters​

NameTypeDescription

angle

A positive or negative number, or an expression that evaluates to a number.

Examples​

cos(pi)
the cos of 0
put cos(the startAngle of graphic 3) into field "Cosine"

Value​

NameTypeDescription

return

The cos function returns a number between -1 and 1.

constant: pi

glossary: function, radian, custom function, return, degree

Compatibility and Support​

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?