End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Math.tan
Math.tan(x) → float
math.c
View on GitHub ↗
static VALUE
math_tan(VALUE unused_obj, VALUE x)
{
return DBL2NUM(tan(Get_Double(x)));
}
Returns the tangent of x in radians.
-
Domain:
(-INFINITY, INFINITY). -
Range:
(-INFINITY, INFINITY).
Examples:
Example
tan(-PI) # => 1.2246467991473532e-16 # -0.0000000000000001 tan(-PI/2) # => -1.633123935319537e+16 # -16331239353195370.0 tan(0.0) # => 0.0 tan(PI/2) # => 1.633123935319537e+16 # 16331239353195370.0 tan(PI) # => -1.2246467991473532e-16 # -0.0000000000000001