==(p1)
public
Show source
static VALUE
nurat_eqeq_p(VALUE self, VALUE other)
{
if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
if (f_zero_p(dat->num) && f_zero_p(other))
return Qtrue;
if (!FIXNUM_P(dat->den))
return Qfalse;
if (FIX2LONG(dat->den) != 1)
return Qfalse;
if (f_eqeq_p(dat->num, other))
return Qtrue;
return Qfalse;
}
}
else if (RB_TYPE_P(other, T_FLOAT)) {
return f_eqeq_p(f_to_f(self), other);
}
else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
if (f_zero_p(adat->num) && f_zero_p(bdat->num))
return Qtrue;
return f_boolcast(f_eqeq_p(adat->num, bdat->num) &&
f_eqeq_p(adat->den, bdat->den));
}
}
else {
return f_eqeq_p(other, self);
}
}