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
math.c
View on GitHub ↗
static VALUE
math_acos(VALUE unused_obj, VALUE x)
{
math_arc(x, acos)
}
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