* complex.c: renamed some static functions.
* rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae96b225c4
commit
53125214cc
@ -1,3 +1,9 @@
|
|||||||
|
Sun Jun 28 09:21:00 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* complex.c: renamed some static functions.
|
||||||
|
|
||||||
|
* rational.c: ditto.
|
||||||
|
|
||||||
Sat Jun 27 19:06:22 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
Sat Jun 27 19:06:22 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* complex.c (nucomp_addsub): new
|
* complex.c (nucomp_addsub): new
|
||||||
|
22
complex.c
22
complex.c
@ -585,8 +585,8 @@ nucomp_negate(VALUE self)
|
|||||||
f_negate(dat->real), f_negate(dat->imag));
|
f_negate(dat->real), f_negate(dat->imag));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
inline static VALUE
|
||||||
nucomp_addsub(VALUE self, VALUE other,
|
f_addsub(VALUE self, VALUE other,
|
||||||
VALUE (*func)(VALUE, VALUE), ID id)
|
VALUE (*func)(VALUE, VALUE), ID id)
|
||||||
{
|
{
|
||||||
if (k_complex_p(other)) {
|
if (k_complex_p(other)) {
|
||||||
@ -617,7 +617,7 @@ nucomp_addsub(VALUE self, VALUE other,
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_add(VALUE self, VALUE other)
|
nucomp_add(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
return nucomp_addsub(self, other, f_add, '+');
|
return f_addsub(self, other, f_add, '+');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -629,7 +629,7 @@ nucomp_add(VALUE self, VALUE other)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_sub(VALUE self, VALUE other)
|
nucomp_sub(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
return nucomp_addsub(self, other, f_sub, '-');
|
return f_addsub(self, other, f_sub, '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -663,8 +663,8 @@ nucomp_mul(VALUE self, VALUE other)
|
|||||||
return rb_num_coerce_bin(self, other, '*');
|
return rb_num_coerce_bin(self, other, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
inline static VALUE
|
||||||
nucomp_divide(VALUE self, VALUE other,
|
f_divide(VALUE self, VALUE other,
|
||||||
VALUE (*func)(VALUE, VALUE), ID id)
|
VALUE (*func)(VALUE, VALUE), ID id)
|
||||||
{
|
{
|
||||||
if (k_complex_p(other)) {
|
if (k_complex_p(other)) {
|
||||||
@ -730,7 +730,7 @@ nucomp_divide(VALUE self, VALUE other,
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_div(VALUE self, VALUE other)
|
nucomp_div(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
return nucomp_divide(self, other, f_quo, id_quo);
|
return f_divide(self, other, f_quo, id_quo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define nucomp_quo nucomp_div
|
#define nucomp_quo nucomp_div
|
||||||
@ -748,7 +748,7 @@ nucomp_div(VALUE self, VALUE other)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_fdiv(VALUE self, VALUE other)
|
nucomp_fdiv(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
return nucomp_divide(self, other, f_fdiv, id_fdiv);
|
return f_divide(self, other, f_fdiv, id_fdiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1113,7 +1113,7 @@ f_tpositive_p(VALUE x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
nucomp_format(VALUE self, VALUE (*func)(VALUE))
|
f_format(VALUE self, VALUE (*func)(VALUE))
|
||||||
{
|
{
|
||||||
VALUE s, impos;
|
VALUE s, impos;
|
||||||
|
|
||||||
@ -1141,7 +1141,7 @@ nucomp_format(VALUE self, VALUE (*func)(VALUE))
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_to_s(VALUE self)
|
nucomp_to_s(VALUE self)
|
||||||
{
|
{
|
||||||
return nucomp_format(self, f_to_s);
|
return f_format(self, f_to_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1156,7 +1156,7 @@ nucomp_inspect(VALUE self)
|
|||||||
VALUE s;
|
VALUE s;
|
||||||
|
|
||||||
s = rb_usascii_str_new2("(");
|
s = rb_usascii_str_new2("(");
|
||||||
rb_str_concat(s, nucomp_format(self, f_inspect));
|
rb_str_concat(s, f_format(self, f_inspect));
|
||||||
rb_str_cat2(s, ")");
|
rb_str_cat2(s, ")");
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
19
rational.c
19
rational.c
@ -934,7 +934,7 @@ nurat_expt(VALUE self, VALUE other)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat <=> numeric -> -1, 0 or +1
|
* rat <=> numeric -> -1, 0, +1 or nil
|
||||||
*
|
*
|
||||||
* Performs comparison and returns -1, 0, or +1.
|
* Performs comparison and returns -1, 0, or +1.
|
||||||
*
|
*
|
||||||
@ -1156,8 +1156,7 @@ nurat_round(VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
nurat_round_common(int argc, VALUE *argv, VALUE self,
|
f_round_common(int argc, VALUE *argv, VALUE self, VALUE (*func)(VALUE))
|
||||||
VALUE (*func)(VALUE))
|
|
||||||
{
|
{
|
||||||
VALUE n, b, s;
|
VALUE n, b, s;
|
||||||
|
|
||||||
@ -1205,7 +1204,7 @@ nurat_round_common(int argc, VALUE *argv, VALUE self,
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_floor_n(int argc, VALUE *argv, VALUE self)
|
nurat_floor_n(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
return nurat_round_common(argc, argv, self, nurat_floor);
|
return f_round_common(argc, argv, self, nurat_floor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1231,7 +1230,7 @@ nurat_floor_n(int argc, VALUE *argv, VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_ceil_n(int argc, VALUE *argv, VALUE self)
|
nurat_ceil_n(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
return nurat_round_common(argc, argv, self, nurat_ceil);
|
return f_round_common(argc, argv, self, nurat_ceil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1257,7 +1256,7 @@ nurat_ceil_n(int argc, VALUE *argv, VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_truncate_n(int argc, VALUE *argv, VALUE self)
|
nurat_truncate_n(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
return nurat_round_common(argc, argv, self, nurat_truncate);
|
return f_round_common(argc, argv, self, nurat_truncate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1284,7 +1283,7 @@ nurat_truncate_n(int argc, VALUE *argv, VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_round_n(int argc, VALUE *argv, VALUE self)
|
nurat_round_n(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
return nurat_round_common(argc, argv, self, nurat_round);
|
return f_round_common(argc, argv, self, nurat_round);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1342,7 +1341,7 @@ nurat_hash(VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
nurat_format(VALUE self, VALUE (*func)(VALUE))
|
f_format(VALUE self, VALUE (*func)(VALUE))
|
||||||
{
|
{
|
||||||
VALUE s;
|
VALUE s;
|
||||||
get_dat1(self);
|
get_dat1(self);
|
||||||
@ -1369,7 +1368,7 @@ nurat_format(VALUE self, VALUE (*func)(VALUE))
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_to_s(VALUE self)
|
nurat_to_s(VALUE self)
|
||||||
{
|
{
|
||||||
return nurat_format(self, f_to_s);
|
return f_format(self, f_to_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1390,7 +1389,7 @@ nurat_inspect(VALUE self)
|
|||||||
VALUE s;
|
VALUE s;
|
||||||
|
|
||||||
s = rb_usascii_str_new2("(");
|
s = rb_usascii_str_new2("(");
|
||||||
rb_str_concat(s, nurat_format(self, f_inspect));
|
rb_str_concat(s, f_format(self, f_inspect));
|
||||||
rb_str_cat2(s, ")");
|
rb_str_cat2(s, ")");
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user