math.rad

From ComputerCraft
Jump to navigation Jump to search

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

Convert the number num from degrees to radians.

ExampleExamplePrint the sine of user input
Read a line from the user, convert it to radians, then print its math.sin.
Code
print(math.sin(math.rad(tonumber(read())))
Output Depends on what the user wrote. For instance, if they were to enter -1, the number printed would be -90.