COS
Last updated
Was this helpful?
Last updated
Was this helpful?
The COS function returns the cosine of a number given in radians.
This function takes a single as input. It parses that Number in radians and outputs its cosine.
number (required, type: Number
) The number to calculate the cosine of. This number is parsed in radians.
cosine (type: Number
) The cosine of the given number.
The following example returns the cosine of 90. Note that while the cosine of 90 degrees is 0, the cosine of 90 radians is -0.4480736161291702, and this is the number the COS function returns:
In order to calculate the cosine of a number of degrees, said number must first be converted into radians using the function . The following example returns the cosine of 90 degrees by first converting 90 degrees into radians and then calculating the cosine of the resulting number. Note that the output is not exactly 0, but it is extremely close. This is the result of small rounding errors:
As a unit, the radian is derived from the ratio of the arc length to the radius of a circle, and thus it often makes sense to express radians as multiples of pi. (Many "neat" angles are expressed nicely as multiples of pi – the quarter turn, 90°, is 0.5π radians, and a complete rotation, 360°, is 2π radians.) To do so, the COS function can be used in tandem with the function. The following example, for instance, returns the cosine of 2π radians: