abs()
  public
  
    
    
Returns the absolute value of num.
12.abs         
(-34.56).abs   
-34.56.abs     
   
  
    Show source    
    
      /*
 *  call-seq:
 *     num.abs   => num or numeric
 *
 *  Returns the absolute value of <i>num</i>.
 *
 *     12.abs         
 *     (-34.56).abs   
 *     -34.56.abs     
 */
static VALUE
num_abs(num)
    VALUE num;
{
    if (RTEST(rb_funcall(num, '<', 1, INT2FIX(0)))) {
        return rb_funcall(num, rb_intern("-@"), 0);
    }
    return num;
}