APIdock / Ruby
/
method

abs2

ruby latest stable - Class: Complex
abs2()
public

Returns square of the absolute value.

Complex (-1).abs2  #=> 1
Complex (3.0, -4.0).abs2  #=> 25.0
static VALUE
nucomp_abs2(VALUE self)
{
 get_dat1(self);
 return f_add(f_mul(dat->real, dat->real),
 f_mul(dat->imag, dat->imag));
}

AltStyle によって変換されたページ (->オリジナル) /