Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Math.acos

(::Math::double x) -> ::Float
Math.acos(x) → float

Returns the arc cosine of x.

  • Domain: [-1, 1].

  • Range: [0, PI].

Examples:

Example
acos(-1.0) # => 3.141592653589793  # PI
acos(0.0)  # => 1.5707963267948966 # PI/2
acos(1.0)  # => 0.0
See also .acosh .asin also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0