Method: Math#tanh

Defined in:
math.c

#tanh(x) ⇒ Float (private)

Returns the hyperbolic tangent of x in radians.

  • Domain: [-INFINITY, INFINITY].

  • Range: [-1, 1].

Examples:

tanh(-INFINITY) # => -1.0
tanh(0.0)       # => 0.0
tanh(INFINITY)  # => 1.0

Returns:



349
350
351
352
353
# File 'math.c', line 349

static VALUE
math_tanh(VALUE unused_obj, VALUE x)
{
    return DBL2NUM(tanh(Get_Double(x)));
}