Flowdock
/(p1) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
static VALUE
nucomp_div(VALUE self, VALUE other)
{
    if (k_complex_p(other)) {
        get_dat2(self, other);

        if (TYPE(adat->real)  == T_FLOAT ||
            TYPE(adat->imag) == T_FLOAT ||
            TYPE(bdat->real)  == T_FLOAT ||
            TYPE(bdat->imag) == T_FLOAT) {
            VALUE magn = m_hypot(bdat->real, bdat->imag);
            VALUE tmp = f_complex_new_bang2(CLASS_OF(self),
                                            f_div(bdat->real, magn),
                                            f_div(bdat->imag, magn));
            return f_div(f_mul(self, f_conj(tmp)), magn);
        }
        return f_div(f_mul(self, f_conj(other)), f_abs2(other));
    }
    if (k_numeric_p(other) && f_real_p(other)) {
        get_dat1(self);

        return f_complex_new2(CLASS_OF(self),
                              f_div(dat->real, other),
                              f_div(dat->imag, other));
    }
    return rb_num_coerce_bin(self, other, '/');
}
Register or log in to add new notes.