Browse the docs

cos

Returns the cosine of an angle given in radians.

Keyboard Maestro: COS

Details #

cos(angle) takes exactly one argument, an angle in radians, and returns a number between -1 and 1.

Parameters #

Takes 1 argument. {{ cos(text) }}

Examples #

cos(0)
→ 1
round(cos(3.14159265), 4)
→ -1

Gotchas #

  • Calling it with no argument or two arguments is an error: cos() takes 1 argument, got 2.

  • Anything that isn't a number is an error: cos() needs a number, got text. Numeric text such as "0.5" is accepted.

  • Float rounding applies: cos(1.5707963) is a tiny number, not exactly 0. Wrap the result in round when you compare it.