End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Math.atanh
Math.atanh(x) → Float
math.c
View on GitHub ↗
static VALUE
math_atanh(VALUE unused_obj, VALUE x)
{
double d;
d = Get_Double(x);
domain_check_range(d, -1.0, +1.0, "atanh");
/* check for pole error */
if (d == -1.0) return DBL2NUM(-HUGE_VAL);
if (d == +1.0) return DBL2NUM(+HUGE_VAL);
return DBL2NUM(atanh(d));
}
Computes the inverse hyperbolic tangent of x.
Domain: (-1, 1)
Codomain: (-INFINITY, INFINITY)
Example
Math.atanh(1) #=> Infinity