atan()
Published Oct 14, 2023
Contribute to Docs
The atan()
function in Lua’s math library evaluates the arctangent (inverse tangent) of a given number. The arctangent is the angle in radians (the answer returned) whose tangent is equal to the given value.
Syntax
math.atan(x)
x
: The number representing the tangent.
Example
In this example, math.atan()
calculates the arctangent of 1.
local x = 1local answer = math.atan(x)local output = string.format("The arctangent of %.2f is approximately %.4f", x, answer)print(output)
This will result in the following output below.
The arctangent of 1.00 is approximately 0.7854
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.