Project

General

Profile

Feature #10378 ยป update_Complex#real_.patch

gogotanaka (Kazuki Tanaka), 10/26/2014 03:19 AM

View differences:

complex.c
1080 1080
/*
1081 1081
 * call-seq:
1082
 *    cmp.real?  ->  false
1082
 *    cmp.real?  ->  true or false
1083 1083
 *
1084
 * Returns false.
1084
 * Returns true if imaginary part is 0.
1085
 *
1086
 *    Complex(7).real?      #=> true
1087
 *    Complex(9, -4).real?  #=> false
1085 1088
 */
1086 1089
static VALUE
1087
nucomp_false(VALUE self)
1090
nucomp_real_p(VALUE self)
1088 1091
{
1089
    return Qfalse;
1092
    get_dat1(self);
1093
    return f_zero_p(dat->imag);
1090 1094
}
1091 1095
#if 0
......
2150 2154
    rb_define_method(rb_cComplex, "~", nucomp_conj, 0); /* gcc */
2151 2155
#endif
2152
    rb_define_method(rb_cComplex, "real?", nucomp_false, 0);
2156
    rb_define_method(rb_cComplex, "real?", nucomp_real_p, 0);
2153 2157
#if 0
2154 2158
    rb_define_method(rb_cComplex, "complex?", nucomp_true, 0);
2155 2159
    rb_define_method(rb_cComplex, "exact?", nucomp_exact_p, 0);
2156
-