Math.hypot(x, y) → float
Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with sides x and y.
Math.hypot(3, 4) #=> 5.0
Source Code
/* * call-seq: * Math.hypot(x, y) => float * * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle * with sides <i>x</i> and <i>y</i>. * * Math.hypot(3, 4) #=> 5.0 */ static VALUE math_hypot(obj, x, y) VALUE obj, x, y; { Need_Float2(x, y); return rb_float_new(hypot(RFLOAT(x)->value, RFLOAT(y)->value)); }
<code/>and<pre/>for code samples.