atan()
Calculates the arc tangent of a number.
atan() is the inverse of tan(). It expects input values in the range of -Infinity to Infinity. By default, atan() returns values in the range -π ÷ 2 (about -1.57) to π ÷ 2 (about 1.57). If the angleMode() is DEGREES then values are returned in the range -90 to 90.
Examples

function setup()
size(100, 100)
fill(0)
background(200)
-- Calculate tan() and atan() values.
local a = PI / 3
local t = tan(a)
local at = atan(t)
-- Display the values.
text(round(a, 3), 35, 25)
text(round(t, 3), 35, 50)
text(round(at, 3), 35, 75)
describe('The numbers 1.047, 1.732, and 1.047 printed on separate rows.')
end

function setup()
size(100, 100)
fill(0)
background(200)
-- Calculate tan() and atan() values.
local a = PI + PI / 3
local t = tan(a)
local at = atan(t)
-- Display the values.
text(round(a, 3), 35, 25)
text(round(t, 3), 35, 50)
text(round(at, 3), 35, 75)
describe('The numbers 4.189, 1.732, and 1.047 printed on separate rows.')
end
Syntax
atan(value)
Parameters
| Parameter | |
|---|---|
| value | Number: value whose arc tangent is to be returned |
Returns
Number: arc tangent of the given value