math.acos

From ComputerCraft
Jump to navigation Jump to 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 (Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \frac{\pi}{3}} ) and 60.