Parameter | Type | Description |
---|---|---|
NUMBER | VALUE(FLOAT) | The input value. |
VALUE(FLOAT) | The cosine of the input value. |
This function takes a numeric value and returns the trigonometric cosine of it. The input value is assumed to be in radians. The input value is interpreted as a floating-point number.
a = cos(0); // a = 1.0
a = cos(pi() / 2); // a = 6.1E-17 (float rounding - close to 0)
a = cos(pi()); // a = -1.0
a = cos(3 * pi() / 2); // a = 1.0
a = cos(2 * pi()); // a = -1.8E-16 (float rounding - close to 0)
The return value of this function relies on TAME's implementation of Cosine, which may be slightly different between implementations.
Due to rounding issues, you may be better off epsilon-rounding the return value, as some results that should be 0 may be nonzero, but very small.