math cos for math

Returns the cosine of the number.

Signature

> math cos --degrees

Parameters

  • --degrees (-d): Use degrees instead of radians

Input/output types:

inputoutput
list<number>list<number>
numbernumber

Examples

Apply the cosine to π

> 3.141592 | math cos | math round --precision 4
-1

Apply the cosine to a list of angles in degrees

> [0 90 180 270 360] | math cos -d
╭───┬───────╮
│ 01.00 │
│ 10.00 │
│ 2-1.00 │
│ 30.00 │
│ 41.00 │
╰───┴───────╯

Tips: Command math cos was not included in the official binaries by default, you have to build it with --features=extra flag