math.atan
From ComputerCraft
Jump to navigation
Jump to search
math.atan Function | |
---|---|
Syntax math.atan(
| |
Returns | number |
API | math |
Source | Lua (source) |
Returns the arctangent (inverse tangent) of num (in radians). This is equivalent to . To convert the output to degrees, you can use math.deg (for example:
math.deg(math.atan(0.5))
).
Name | arctangent |
---|---|
Lua function | math.atan |
Usual notation | |
Definition | |
Domain of x for real result | all real numbers |
Range of usual principal value (radians) |
|
|||
Read a line from the user, print its arctangent in radians, then in degrees. | |||
Code | local num = math.atan(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 0.46364760900081 and 26.565051177078 . |
Retrieved from "https://wiki.computercraft.cc/index.php?title=Math.atan&oldid=5902"