TAN
Last updated
Was this helpful?
Last updated
Was this helpful?
The TAN function returns the tangent of a number given in radians.
This function takes a single as input. It parses that number in radians and outputs its tangent as a Number.
number(required, type: Number
) The number to calculate the tangent of. This number is parsed in radians.
tangent (type: Number
) The tangent of the given number.
The following example returns the tangent of 45. Note that while the tangent of 45 degrees is 1, the tangent of 45 radians is 1.6197751905438615, and this is the number the TAN function returns:
In order to calculate the tangent of a number of degrees, said number must first be converted into radians using the function . The following example returns the tangent of forty-five degrees by first converting forty-five degrees into radians and then calculating the tangent of the resulting number. Note that the output is not exactly 1, but it is extremely close. This is the result of small rounding errors:
On the subject of rounding errors, it because of them that the TAN function does not return infinity or undefined even when that would be the mathematically correct value of the tangent of a given number. For instance, the tangent of 90° is undefined – mathematically, the answer approaches infinity – but when the function TAN is used to calculate the tangent of ninety degrees, as in the following example, it does not return infinity or undefined, but instead a large (but finite) number. This behavior matches that of most computational calculators and should be sufficient for most practical purposes: