math.tan

From ComputerCraft
Jump to: navigation, search

math.tan
Function
Syntax
math.tan()
Returns number
API math
Source Lua (source)

Returns the tangent of num.

Note Note: The argument must be given in radians. If it is in degrees, use the math.rad function to convert it.

ExampleExamplePrint the tangent of user input
Read a line from the user, convert it to radians using math.rad, then print its tangent.
Code
print(math.tan(math.rad(tonumber(read())))
Output Depends. If the user wrote 45, the output would be 1.