math.acos

From ComputerCraft
Jump to: navigation, search

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

Return the arccos of num in radians.

ExampleExamplePrint the arccosine of user input
Read a line from the user, print its arccos in radians, then in degrees.
Code
local num = math.acos(tonumber(read()))
print(num)
print(math.deg(num))
Output Depends on what the user wrote. For instance, if they were to enter 0.5, the numbers printed would be 1.0471975512 () and 60.