diff options
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -195,6 +195,8 @@ f_negative_p(VALUE x) return rb_funcall(x, '<', 1, ZERO); } +#define f_positive_p(x) (!f_negative_p(x)) + inline static VALUE f_zero_p(VALUE x) { @@ -203,6 +205,8 @@ f_zero_p(VALUE x) return rb_funcall(x, id_equal_p, 1, ZERO); } +#define f_nonzero_p(x) (!f_zero_p(x)) + inline static VALUE f_one_p(VALUE x) { @@ -487,7 +491,7 @@ static VALUE m_sqrt(VALUE x) { if (f_real_p(x)) { - if (!f_negative_p(x)) + if (f_positive_p(x)) return m_sqrt_bang(x); return f_complex_new2(rb_cComplex, ZERO, m_sqrt_bang(f_negate(x))); } @@ -1326,7 +1330,7 @@ numeric_abs2(VALUE self) static VALUE numeric_arg(VALUE self) { - if (!f_negative_p(self)) + if (f_positive_p(self)) return INT2FIX(0); return rb_const_get(rb_mMath, id_PI); } |