# Cos

*162*pages on

this wiki

cos( angle )

Calculates the cosine of an angle.

- angle
- The angle, using a full circle range of 0.0-1.0.

The `cos()`

function calculates the cosine of an angle.

Pico-8 uses an input range of 0.0 to 1.0 to represent the angle, a percentage of the unit circle. An angle of π (3.1415) radians (180 degrees) corresponds to a Pico-8 angle of 0.5.

Pico-8 measures the angle in a clockwise direction, with 0.0 to the right, 0.25 downward, and so on. This is inverted from the convention used in traditional geometry, though the inversion only affects sin(), not `cos()`

.

## Examples Edit

for t=0,1,0.125 do print('cos('..t..') = '..cos(t)) end

prints:

cos(0) = 1 cos(0.125) = 0.7071 cos(0.25) = 0 cos(0.375) = -0.7071 cos(0.5) = -1 cos(0.625) = -0.7071 cos(0.75) = 0 cos(0.875) = 0.7071 cos(1) = 1