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. Some refer to these units as "turns". For instance, 180° or π (3.14159) radians corresponds to 0.5 turns in PICO-8's representation of angles. In fact, for fans of τ (tau), it's just a matter of dropping τ from your expression.

**Important:** Pico-8 measures the angle in a *clockwise* direction on the Cartesian plane, 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