+(p1)
public
Show source
static VALUE
nurat_add(VALUE self, VALUE other)
{
if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
return f_addsub(self,
dat->num, dat->den,
other, ONE, '+');
}
}
else if (RB_TYPE_P(other, T_FLOAT)) {
return f_add(f_to_f(self), other);
}
else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
return f_addsub(self,
adat->num, adat->den,
bdat->num, bdat->den, '+');
}
}
else {
return rb_num_coerce_bin(self, other, '+');
}
}