Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Math.atan

Math.atan(x) → Float

Returns the arc tangent of x.

  • Domain: [-INFINITY, INFINITY].

  • Range: [-PI/2, PI/2] .

Examples:

Example
atan(-INFINITY) # => -1.5707963267948966 # -PI2
atan(-PI)       # => -1.2626272556789115
atan(-PI/2)     # => -1.0038848218538872
atan(0.0)       # => 0.0
atan(PI/2)      # => 1.0038848218538872
atan(PI)        # => 1.2626272556789115
atan(INFINITY)  # => 1.5707963267948966  # PI/2
See also .asinh .atan2 .asin .atanh also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0