зеркало из https://github.com/github/ruby.git
* rational.c: removed unused code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d4832b7aac
Коммит
249705229f
|
@ -1,3 +1,7 @@
|
|||
Mon Sep 8 00:58:04 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* rational.c: removed unused code.
|
||||
|
||||
Mon Sep 8 00:04:09 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* enc/trans/iso2022.trans: upcase to iso-2022-jp.
|
||||
|
|
11
rational.c
11
rational.c
|
@ -1027,7 +1027,7 @@ nurat_to_f(VALUE self)
|
|||
{
|
||||
VALUE num, den;
|
||||
int minus = 0;
|
||||
long nl, dl, ml, ne, de;
|
||||
long nl, dl, ne, de;
|
||||
int e;
|
||||
double f;
|
||||
|
||||
|
@ -1048,7 +1048,6 @@ nurat_to_f(VALUE self)
|
|||
|
||||
nl = i_ilog2(num);
|
||||
dl = i_ilog2(den);
|
||||
ml = (long)(log(DBL_MAX) / log(2.0) - 1); /* should be a static */
|
||||
|
||||
ne = 0;
|
||||
if (nl > ml) {
|
||||
|
@ -1311,10 +1310,14 @@ string_to_r_internal(VALUE self)
|
|||
v = f_add(v, f_to_i(fp));
|
||||
v = f_div(v, l);
|
||||
}
|
||||
if (!NIL_P(exp))
|
||||
v = f_mul(v, f_expt(INT2FIX(10), f_to_i(exp)));
|
||||
if (!NIL_P(si) && *StringValuePtr(si) == '-')
|
||||
v = f_negate(v);
|
||||
if (!NIL_P(exp))
|
||||
v = f_mul(v, f_expt(INT2FIX(10), f_to_i(exp)));
|
||||
#if 0
|
||||
if (!NIL_P(de) && (!NIL_P(fp) || !NIL_P(exp)))
|
||||
return rb_assoc_new(v, rb_str_new2("dummy"));
|
||||
#endif
|
||||
if (!NIL_P(de))
|
||||
v = f_div(v, f_to_i(de));
|
||||
|
||||
|
|
|
@ -631,9 +631,6 @@ class Complex_Test < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_parse
|
||||
assert_equal(Complex(0), ''.to_c)
|
||||
assert_equal(Complex(0), ' '.to_c)
|
||||
assert_equal(Complex(5), "\f\n\r\t\v5\0".to_c)
|
||||
assert_equal(Complex(5), '5'.to_c)
|
||||
assert_equal(Complex(-5), '-5'.to_c)
|
||||
assert_equal(Complex(5,3), '5+3i'.to_c)
|
||||
|
@ -674,6 +671,12 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(Complex(0.0,3.0), '3e0i'.to_c)
|
||||
assert_equal(Complex(0.0,-3.0), '-3e0i'.to_c)
|
||||
|
||||
assert_equal(Complex(0.33), '.33'.to_c)
|
||||
assert_equal(Complex(0.33), '0.33'.to_c)
|
||||
assert_equal(Complex(-0.33), '-.33'.to_c)
|
||||
assert_equal(Complex(-0.33), '-0.33'.to_c)
|
||||
assert_equal(Complex(-0.33), '-0.3_3'.to_c)
|
||||
|
||||
assert_equal(Complex.polar(10,10), '10@10'.to_c)
|
||||
assert_equal(Complex.polar(-10,-10), '-10@-10'.to_c)
|
||||
assert_equal(Complex.polar(10.5,10.5), '10.5@10.5'.to_c)
|
||||
|
@ -719,11 +722,20 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(Complex(0.0,3.0), Complex('3e0i'))
|
||||
assert_equal(Complex(0.0,-3.0), Complex('-3e0i'))
|
||||
|
||||
assert_equal(Complex(0.33), Complex('.33'))
|
||||
assert_equal(Complex(0.33), Complex('0.33'))
|
||||
assert_equal(Complex(-0.33), Complex('-.33'))
|
||||
assert_equal(Complex(-0.33), Complex('-0.33'))
|
||||
assert_equal(Complex(-0.33), Complex('-0.3_3'))
|
||||
|
||||
assert_equal(Complex.polar(10,10), Complex('10@10'))
|
||||
assert_equal(Complex.polar(-10,-10), Complex('-10@-10'))
|
||||
assert_equal(Complex.polar(10.5,10.5), Complex('10.5@10.5'))
|
||||
assert_equal(Complex.polar(-10.5,-10.5), Complex('-10.5@-10.5'))
|
||||
|
||||
assert_equal(Complex(0), ''.to_c)
|
||||
assert_equal(Complex(0), ' '.to_c)
|
||||
assert_equal(Complex(5), "\f\n\r\t\v5\0".to_c)
|
||||
assert_equal(Complex(0), '_'.to_c)
|
||||
assert_equal(Complex(0), '_5'.to_c)
|
||||
assert_equal(Complex(5), '5_'.to_c)
|
||||
|
@ -734,6 +746,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(Complex(5,3), '5+3ix'.to_c)
|
||||
assert_raise(ArgumentError){ Complex('')}
|
||||
assert_raise(ArgumentError){ Complex('_')}
|
||||
assert_raise(ArgumentError){ Complex("\f\n\r\t\v5\0")}
|
||||
assert_raise(ArgumentError){ Complex('_5')}
|
||||
assert_raise(ArgumentError){ Complex('5_')}
|
||||
assert_raise(ArgumentError){ Complex('5x')}
|
||||
|
@ -741,7 +754,6 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError){ Complex('5+3_i')}
|
||||
assert_raise(ArgumentError){ Complex('5+3i_')}
|
||||
assert_raise(ArgumentError){ Complex('5+3ix')}
|
||||
assert_raise(ArgumentError){ Complex("5\0")}
|
||||
|
||||
if defined?(Rational) && defined?(''.to_r)
|
||||
assert_equal(Complex(Rational(1,5)), '1/5'.to_c)
|
||||
|
|
|
@ -866,9 +866,6 @@ class Rational_Test < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_parse
|
||||
assert_equal(Rational(0), ''.to_r)
|
||||
assert_equal(Rational(0), ' '.to_r)
|
||||
assert_equal(Rational(5), "\f\n\r\t\v5\0".to_r)
|
||||
assert_equal(Rational(5), '5'.to_r)
|
||||
assert_equal(Rational(-5), '-5'.to_r)
|
||||
assert_equal(Rational(5,3), '5/3'.to_r)
|
||||
|
@ -890,7 +887,9 @@ class Rational_Test < Test::Unit::TestCase
|
|||
# assert_equal(Rational(5,-3), '5e0/-3'.to_r)
|
||||
# assert_equal(Rational(-5,-3), '-5e0/-3'.to_r)
|
||||
|
||||
assert_equal(Rational(33,100), '.33'.to_r)
|
||||
assert_equal(Rational(33,100), '0.33'.to_r)
|
||||
assert_equal(Rational(-33,100), '-.33'.to_r)
|
||||
assert_equal(Rational(-33,100), '-0.33'.to_r)
|
||||
assert_equal(Rational(-33,100), '-0.3_3'.to_r)
|
||||
|
||||
|
@ -911,24 +910,39 @@ class Rational_Test < Test::Unit::TestCase
|
|||
# assert_equal(Rational(5,-3), Rational('5/-3'))
|
||||
# assert_equal(Rational(-5,-3), Rational('-5/-3'))
|
||||
|
||||
assert_equal(Rational(5), Rational('5.0'))
|
||||
assert_equal(Rational(-5), Rational('-5.0'))
|
||||
assert_equal(Rational(5,3), Rational('5.0/3'))
|
||||
assert_equal(Rational(-5,3), Rational('-5.0/3'))
|
||||
# assert_equal(Rational(5,-3), Rational('5.0/-3'))
|
||||
# assert_equal(Rational(-5,-3), Rational('-5.0/-3'))
|
||||
|
||||
assert_equal(Rational(5), Rational('5e0'))
|
||||
assert_equal(Rational(-5), Rational('-5e0'))
|
||||
assert_equal(Rational(5,3), Rational('5e0/3'))
|
||||
assert_equal(Rational(-5,3), Rational('-5e0/3'))
|
||||
# assert_equal(Rational(5,-3), Rational('5e0/-3'))
|
||||
# assert_equal(Rational(-5,-3), Rational('-5e0/-3'))
|
||||
|
||||
assert_equal(Rational(33,100), Rational('.33'))
|
||||
assert_equal(Rational(33,100), Rational('0.33'))
|
||||
assert_equal(Rational(-33,100), Rational('-.33'))
|
||||
assert_equal(Rational(-33,100), Rational('-0.33'))
|
||||
assert_equal(Rational(-33,100), Rational('-0.3_3'))
|
||||
|
||||
assert_equal(Rational(1,2), Rational('5e-1'))
|
||||
assert_equal(Rational(50), Rational('5e+1'))
|
||||
assert_equal(Rational(1,2), Rational('5.0e-1'))
|
||||
assert_equal(Rational(50), Rational('5.0e+1'))
|
||||
assert_equal(Rational(50), Rational('5e1'))
|
||||
assert_equal(Rational(50), Rational('5E1'))
|
||||
assert_equal(Rational(500), Rational('5e2'))
|
||||
assert_equal(Rational(5000), Rational('5e3'))
|
||||
assert_equal(Rational(500000000000), Rational('5e1_1'))
|
||||
|
||||
assert_equal(Rational(5.0), Rational('5.0'))
|
||||
assert_equal(Rational(-5.0), Rational('-5.0'))
|
||||
assert_equal(Rational(5.0,3), Rational('5.0/3'))
|
||||
assert_equal(Rational(-5.0,3), Rational('-5.0/3'))
|
||||
# assert_equal(Rational(5.0,-3), Rational('5.0/-3'))
|
||||
# assert_equal(Rational(-5.0,-3), Rational('-5.0/-3'))
|
||||
|
||||
assert_equal(Rational(0), ''.to_r)
|
||||
assert_equal(Rational(0), ' '.to_r)
|
||||
assert_equal(Rational(5), "\f\n\r\t\v5\0".to_r)
|
||||
assert_equal(Rational(0), '_'.to_r)
|
||||
assert_equal(Rational(0), '_5'.to_r)
|
||||
assert_equal(Rational(5), '5_'.to_r)
|
||||
|
@ -939,6 +953,7 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_equal(Rational(5,3), '5/3x'.to_r)
|
||||
assert_raise(ArgumentError){ Rational('')}
|
||||
assert_raise(ArgumentError){ Rational('_')}
|
||||
assert_raise(ArgumentError){ Rational("\f\n\r\t\v5\0")}
|
||||
assert_raise(ArgumentError){ Rational('_5')}
|
||||
assert_raise(ArgumentError){ Rational('5_')}
|
||||
assert_raise(ArgumentError){ Rational('5x')}
|
||||
|
@ -946,7 +961,6 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError){ Rational('5/3_')}
|
||||
assert_raise(ArgumentError){ Rational('5/3.3')}
|
||||
assert_raise(ArgumentError){ Rational('5/3x')}
|
||||
assert_raise(ArgumentError){ Rational("5\0")}
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
Загрузка…
Ссылка в новой задаче