End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Math.exp
Math.exp(x) → Float
math.c
View on GitHub ↗
static VALUE
math_exp(VALUE unused_obj, VALUE x)
{
return DBL2NUM(exp(Get_Double(x)));
}
Returns e**x.
Domain: (-INFINITY, INFINITY)
Codomain: (0, INFINITY)
Example
Math.exp(0) #=> 1.0 Math.exp(1) #=> 2.718281828459045 Math.exp(1.5) #=> 4.4816890703380645