summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--complex.c93
-rw-r--r--rational.c90
2 files changed, 0 insertions, 183 deletions
diff --git a/complex.c b/complex.c
index a8fdbc0e01..a62d6e2512 100644
--- a/complex.c
+++ b/complex.c
@@ -312,30 +312,6 @@ nucomp_s_alloc(VALUE klass)
return nucomp_s_new_internal(klass, ZERO, ZERO);
}
-#if 0
-static VALUE
-nucomp_s_new_bang(int argc, VALUE *argv, VALUE klass)
-{
- VALUE real, imag;
-
- switch (rb_scan_args(argc, argv, "11", &real, &imag)) {
- case 1:
- if (!k_numeric_p(real))
- real = f_to_i(real);
- imag = ZERO;
- break;
- default:
- if (!k_numeric_p(real))
- real = f_to_i(real);
- if (!k_numeric_p(imag))
- imag = f_to_i(imag);
- break;
- }
-
- return nucomp_s_new_internal(klass, real, imag);
-}
-#endif
-
inline static VALUE
f_complex_new_bang1(VALUE klass, VALUE x)
{
@@ -542,36 +518,6 @@ m_sin(VALUE x)
}
}
-#if 0
-imp1(sqrt)
-
-VALUE
-rb_complex_sqrt(VALUE x)
-{
- int pos;
- VALUE a, re, im;
- get_dat1(x);
-
- pos = f_positive_p(dat->imag);
- a = f_abs(x);
- re = m_sqrt_bang(f_div(f_add(a, dat->real), TWO));
- im = m_sqrt_bang(f_div(f_sub(a, dat->real), TWO));
- if (!pos) im = f_negate(im);
- return f_complex_new2(rb_cComplex, re, im);
-}
-
-static VALUE
-m_sqrt(VALUE x)
-{
- if (f_real_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)));
- }
- return rb_complex_sqrt(x);
-}
-#endif
-
static VALUE
f_complex_polar(VALUE klass, VALUE x, VALUE y)
{
@@ -1154,15 +1100,6 @@ nucomp_conj(VALUE self)
return f_complex_new2(CLASS_OF(self), dat->real, f_negate(dat->imag));
}
-#if 0
-/* :nodoc: */
-static VALUE
-nucomp_true(VALUE self)
-{
- return Qtrue;
-}
-#endif
-
/*
* call-seq:
* cmp.real? -> false
@@ -1175,23 +1112,6 @@ nucomp_false(VALUE self)
return Qfalse;
}
-#if 0
-/* :nodoc: */
-static VALUE
-nucomp_exact_p(VALUE self)
-{
- get_dat1(self);
- return f_boolcast(k_exact_p(dat->real) && k_exact_p(dat->imag));
-}
-
-/* :nodoc: */
-static VALUE
-nucomp_inexact_p(VALUE self)
-{
- return f_boolcast(!nucomp_exact_p(self));
-}
-#endif
-
/*
* call-seq:
* cmp.denominator -> integer
@@ -2219,12 +2139,7 @@ Init_Complex(void)
rb_define_alloc_func(rb_cComplex, nucomp_s_alloc);
rb_undef_method(CLASS_OF(rb_cComplex), "allocate");
-#if 0
- rb_define_private_method(CLASS_OF(rb_cComplex), "new!", nucomp_s_new_bang, -1);
- rb_define_private_method(CLASS_OF(rb_cComplex), "new", nucomp_s_new, -1);
-#else
rb_undef_method(CLASS_OF(rb_cComplex), "new");
-#endif
rb_define_singleton_method(rb_cComplex, "rectangular", nucomp_s_new, -1);
rb_define_singleton_method(rb_cComplex, "rect", nucomp_s_new, -1);
@@ -2273,16 +2188,8 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "polar", nucomp_polar, 0);
rb_define_method(rb_cComplex, "conjugate", nucomp_conj, 0);
rb_define_method(rb_cComplex, "conj", nucomp_conj, 0);
-#if 0
- rb_define_method(rb_cComplex, "~", nucomp_conj, 0); /* gcc */
-#endif
rb_define_method(rb_cComplex, "real?", nucomp_false, 0);
-#if 0
- rb_define_method(rb_cComplex, "complex?", nucomp_true, 0);
- rb_define_method(rb_cComplex, "exact?", nucomp_exact_p, 0);
- rb_define_method(rb_cComplex, "inexact?", nucomp_inexact_p, 0);
-#endif
rb_define_method(rb_cComplex, "numerator", nucomp_numerator, 0);
rb_define_method(rb_cComplex, "denominator", nucomp_denominator, 0);
diff --git a/rational.c b/rational.c
index d0a76600ca..0add47dc53 100644
--- a/rational.c
+++ b/rational.c
@@ -422,38 +422,6 @@ nurat_s_alloc(VALUE klass)
return nurat_s_new_internal(klass, ZERO, ONE);
}
-#if 0
-static VALUE
-nurat_s_new_bang(int argc, VALUE *argv, VALUE klass)
-{
- VALUE num, den;
-
- switch (rb_scan_args(argc, argv, "11", &num, &den)) {
- case 1:
- if (!k_integer_p(num))
- num = f_to_i(num);
- den = ONE;
- break;
- default:
- if (!k_integer_p(num))
- num = f_to_i(num);
- if (!k_integer_p(den))
- den = f_to_i(den);
-
- if (INT_NEGATIVE_P(den)) {
- num = rb_int_uminus(num);
- den = rb_int_uminus(den);
- }
- else if (INT_ZERO_P(den)) {
- rb_num_zerodiv();
- }
- break;
- }
-
- return nurat_s_new_internal(klass, num, den);
-}
-#endif
-
inline static VALUE
f_rational_new_bang1(VALUE klass, VALUE x)
{
@@ -1228,39 +1196,6 @@ nurat_coerce(VALUE self, VALUE other)
return Qnil;
}
-#if 0
-/* :nodoc: */
-static VALUE
-nurat_idiv(VALUE self, VALUE other)
-{
- return f_idiv(self, other);
-}
-
-/* :nodoc: */
-static VALUE
-nurat_quot(VALUE self, VALUE other)
-{
- return f_truncate(f_div(self, other));
-}
-
-/* :nodoc: */
-static VALUE
-nurat_quotrem(VALUE self, VALUE other)
-{
- VALUE val = f_truncate(f_div(self, other));
- return rb_assoc_new(val, f_sub(self, f_mul(other, val)));
-}
-#endif
-
-#if 0
-/* :nodoc: */
-static VALUE
-nurat_true(VALUE self)
-{
- return Qtrue;
-}
-#endif
-
/*
* call-seq:
* rat.positive? -> true or false
@@ -2199,17 +2134,6 @@ float_decode_internal(VALUE self, VALUE *rf, VALUE *rn)
*rn = INT2FIX(n);
}
-#if 0
-static VALUE
-float_decode(VALUE self)
-{
- VALUE f, n;
-
- float_decode_internal(self, &f, &n);
- return rb_assoc_new(f, n);
-}
-#endif
-
/*
* call-seq:
* flt.to_r -> rational
@@ -2699,12 +2623,7 @@ Init_Rational(void)
rb_define_alloc_func(rb_cRational, nurat_s_alloc);
rb_undef_method(CLASS_OF(rb_cRational), "allocate");
-#if 0
- rb_define_private_method(CLASS_OF(rb_cRational), "new!", nurat_s_new_bang, -1);
- rb_define_private_method(CLASS_OF(rb_cRational), "new", nurat_s_new, -1);
-#else
rb_undef_method(CLASS_OF(rb_cRational), "new");
-#endif
rb_define_global_function("Rational", nurat_f_rational, -1);
@@ -2724,15 +2643,6 @@ Init_Rational(void)
rb_define_method(rb_cRational, "==", nurat_eqeq_p, 1);
rb_define_method(rb_cRational, "coerce", nurat_coerce, 1);
-#if 0
- rb_define_method(rb_cRational, "quot", nurat_quot, 1);
- rb_define_method(rb_cRational, "quotrem", nurat_quotrem, 1);
-#endif
-
-#if 0
- rb_define_method(rb_cRational, "rational?", nurat_true, 0);
- rb_define_method(rb_cRational, "exact?", nurat_true, 0);
-#endif
rb_define_method(rb_cRational, "positive?", nurat_positive_p, 0);
rb_define_method(rb_cRational, "negative?", nurat_negative_p, 0);
rb_define_method(rb_cRational, "abs", rb_rational_abs, 0);