зеркало из https://github.com/github/ruby.git
* rational.c (nurat_equal_p): Rational(0,x) and 0 are equivalent,
anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c7f4ebc8b7
Коммит
e0d427e855
|
@ -1,3 +1,8 @@
|
|||
Fri Jun 13 21:55:48 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* rational.c (nurat_equal_p): Rational(0,x) and 0 are equivalent,
|
||||
anyway.
|
||||
|
||||
Fri Jun 13 21:26:39 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c (string_to_c, nucomp_s_convert): preserve the current
|
||||
|
|
|
@ -865,6 +865,9 @@ nurat_equal_p(VALUE self, VALUE other)
|
|||
{
|
||||
get_dat1(self);
|
||||
|
||||
if (f_zero_p(dat->num) && f_zero_p(other))
|
||||
return Qtrue;
|
||||
|
||||
if (!FIXNUM_P(dat->den))
|
||||
return Qfalse;
|
||||
if (FIX2LONG(dat->den) != 1)
|
||||
|
@ -879,6 +882,9 @@ nurat_equal_p(VALUE self, VALUE other)
|
|||
{
|
||||
get_dat2(self, other);
|
||||
|
||||
if (f_zero_p(adat->num) && f_zero_p(bdat->num))
|
||||
return Qtrue;
|
||||
|
||||
return f_boolcast(f_equal_p(adat->num, bdat->num) &&
|
||||
f_equal_p(adat->den, bdat->den));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче