* complex.c, rational.c: fixed indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-04-22 13:17:04 +00:00
Родитель 9f9a532d98
Коммит f80616b6d2
2 изменённых файлов: 251 добавлений и 225 удалений

Просмотреть файл

@ -74,12 +74,14 @@ f_add(VALUE x, VALUE y)
r = x;
else
r = rb_funcall(x, '+', 1, y);
} else if (FIXNUM_P(x)) {
}
else if (FIXNUM_P(x)) {
if (FIX2LONG(x) == 0)
r = y;
else
r = rb_funcall(x, '+', 1, y);
} else
}
else
r = rb_funcall(x, '+', 1, y);
return r;
}
@ -95,7 +97,8 @@ f_cmp(VALUE x, VALUE y)
else if (c < 0)
c = -1;
r = INT2FIX(c);
} else
}
else
r = rb_funcall(x, id_cmp, 1, y);
return r;
}
@ -146,22 +149,26 @@ f_mul(VALUE x, VALUE y)
r = rb_float_new(0.0);
else
r = ZERO;
} else if (_iy == 1)
}
else if (_iy == 1)
r = x;
else
r = rb_funcall(x, '*', 1, y);
} else if (FIXNUM_P(x)) {
}
else if (FIXNUM_P(x)) {
long _ix = FIX2LONG(x);
if (_ix == 0) {
if (TYPE(y) == T_FLOAT)
r = rb_float_new(0.0);
else
r = ZERO;
} else if (_ix == 1)
}
else if (_ix == 1)
r = y;
else
r = rb_funcall(x, '*', 1, y);
} else
}
else
r = rb_funcall(x, '*', 1, y);
return r;
}
@ -175,7 +182,8 @@ f_sub(VALUE x, VALUE y)
r = x;
else
r = rb_funcall(x, '-', 1, y);
} else
}
else
r = rb_funcall(x, '-', 1, y);
return r;
}
@ -403,13 +411,15 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE image)
return nucomp_s_new_internal(klass,
f_sub(real, dat->image),
f_add(ZERO, dat->real));
} else if (f_scalar_p(image)) {
}
else if (f_scalar_p(image)) {
get_dat1(real);
return nucomp_s_new_internal(klass,
dat->real,
f_add(dat->image, image));
} else {
}
else {
get_dat2(real, image);
return nucomp_s_new_internal(klass,
@ -538,7 +548,8 @@ m_sqrt(VALUE x)
return m_sqrt_bang(x);
else
return f_complex_new2(rb_cComplex, ZERO, m_sqrt_bang(f_negate(x)));
} else {
}
else {
get_dat1(x);
if (f_negative_p(dat->image))
@ -759,7 +770,8 @@ nucomp_expt(VALUE self, VALUE other)
n = f_sub(n, ONE);
}
return z;
} else {
}
else {
return f_expt(f_div(f_to_r(ONE), self), f_negate(other));
}
case T_FLOAT:
@ -989,7 +1001,8 @@ nucomp_to_s(VALUE self)
rb_str_cat2(s, "(");
rb_str_concat(s, f_to_s(rezero ? dat->image : f_abs(dat->image)));
rb_str_cat2(s, ")i");
} else {
}
else {
rb_str_concat(s, f_to_s(rezero ? dat->image : f_abs(dat->image)));
rb_str_cat2(s, "i");
}

Просмотреть файл

@ -58,12 +58,14 @@ f_add(VALUE x, VALUE y)
r = x;
else
r = rb_funcall(x, '+', 1, y);
} else if (FIXNUM_P(x)) {
}
else if (FIXNUM_P(x)) {
if (FIX2LONG(x) == 0)
r = y;
else
r = rb_funcall(x, '+', 1, y);
} else
}
else
r = rb_funcall(x, '+', 1, y);
return r;
}
@ -79,7 +81,8 @@ f_cmp(VALUE x, VALUE y)
else if (c < 0)
c = -1;
r = INT2FIX(c);
} else
}
else
r = rb_funcall(x, id_cmp, 1, y);
return r;
}
@ -130,22 +133,26 @@ f_mul(VALUE x, VALUE y)
r = rb_float_new(0.0);
else
r = ZERO;
} else if (_iy == 1)
}
else if (_iy == 1)
r = x;
else
r = rb_funcall(x, '*', 1, y);
} else if (FIXNUM_P(x)) {
}
else if (FIXNUM_P(x)) {
long _ix = FIX2LONG(x);
if (_ix == 0) {
if (TYPE(y) == T_FLOAT)
r = rb_float_new(0.0);
else
r = ZERO;
} else if (_ix == 1)
}
else if (_ix == 1)
r = y;
else
r = rb_funcall(x, '*', 1, y);
} else
}
else
r = rb_funcall(x, '*', 1, y);
return r;
}
@ -159,7 +166,8 @@ f_sub(VALUE x, VALUE y)
r = x;
else
r = rb_funcall(x, '-', 1, y);
} else
}
else
r = rb_funcall(x, '-', 1, y);
return r;
}
@ -635,7 +643,8 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
num = f_idiv(c, g);
a = f_idiv(bden, g);
den = f_mul(a, b);
} else {
}
else {
VALUE g = f_gcd(aden, bden);
VALUE a = f_mul(anum, f_idiv(bden, g));
VALUE b = f_mul(bnum, f_idiv(aden, g));
@ -739,7 +748,8 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
num = f_imul(an / g1, bn / g2);
den = f_imul(ad / g2, bd / g1);
} else {
}
else {
VALUE g1 = f_gcd(anum, bden);
VALUE g2 = f_gcd(aden, bnum);
@ -890,7 +900,8 @@ nurat_cmp(VALUE self, VALUE other)
FIXNUM_P(bdat->num) && FIXNUM_P(bdat->den)) {
num1 = f_imul(FIX2LONG(adat->num), FIX2LONG(bdat->den));
num2 = f_imul(FIX2LONG(bdat->num), FIX2LONG(adat->den));
} else {
}
else {
num1 = f_mul(adat->num, bdat->den);
num2 = f_mul(bdat->num, adat->den);
}
@ -954,6 +965,7 @@ nurat_idiv(VALUE self, VALUE other)
{
return f_floor(f_div(self, other));
}
static VALUE
nurat_mod(VALUE self, VALUE other)
{
@ -1044,7 +1056,8 @@ nurat_round(VALUE self)
num = f_add(f_mul(num, TWO), dat->den);
den = f_mul(dat->den, TWO);
return f_negate(f_idiv(num, den));
} else {
}
else {
VALUE num = f_add(f_mul(dat->num, TWO), dat->den);
VALUE den = f_mul(dat->den, TWO);
return f_idiv(num, den);