End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Math.hypot
Math.hypot(x, y) → Float
math.c
View on GitHub ↗
static VALUE
math_hypot(VALUE unused_obj, VALUE x, VALUE y)
{
return DBL2NUM(hypot(Get_Double(x), Get_Double(y)));
}
Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with sides x and y.
Example
Math.hypot(3, 4) #=> 5.0