Skip to content

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

class method

Math.acos

Math.acos(x) → Float

Computes the arc cosine of x. Returns 0..PI.

Domain: [-1, 1]

Codomain: [0, PI]

Example
Math.acos(0) == Math::PI/2  #=> true
See also .acosh .asin also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1