MathLib.cos()

MathLib.cos() calculates the cosine of a number (given in radians). \[ \text{MathLib.cos}(x) = \cos(x) \]

Examples

To calculate the cosine of 2 type: MathLib.cos(2);

Specification

MathLib.cos accepts one argument. Any additional arguments will be ignored. The type of the argument should be number. For other argument types see the unary function specification.
  1. MathLib.cos(NaN) = NaN
  2. MathLib.cos(+∞) = NaN
  3. MathLib.cos(-∞) = NaN
  4. otherwise MathLib.cos(x) = cosine of x

Implementation

MathLib uses the built-in JavaScript implementation Math.cos.

Possible issues

MathLib expects the input argument to be in radians. If you want to insert the angle in degrees (let's say 90°), use: MathLib.cos(MathLib.degToRad(90));

Tests

Categories: unary Function