static public Method

Math.sqrt(p1)

Math.sqrt(numeric)     float

Returns the non-negative square root of numeric.

Source Code

/*
*  call-seq:
*     Math.sqrt(numeric)    => float
*  
*  Returns the non-negative square root of <i>numeric</i>.
*/

static VALUE
math_sqrt(obj, x)
   VALUE obj, x;
{
   double d;

   Need_Float(x);
   errno = 0;
   d = sqrt(RFLOAT(x)->value);
   domain_check(d, "sqrt");
   return rb_float_new(d);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.