1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* complex.c, rational.c ({nucomp,nurat}_expt): added a check.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2010-11-22 22:31:55 +00:00
parent 6e9ca64843
commit 1d8ca7a237
3 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Tue Nov 23 07:29:24 2010 Tadayoshi Funaba <tadf@dotrb.org>
* complex.c, rational.c ({nucomp,nurat}_expt): added a check.
Tue Nov 23 07:27:27 2010 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb (daynum): should be private.

View file

@ -1,5 +1,5 @@
/*
complex.c: Coded by Tadayoshi Funaba 2008,2009
complex.c: Coded by Tadayoshi Funaba 2008-2010
This implementation is based on Keiju Ishitsuka's Complex library
which is written in ruby.
@ -824,7 +824,7 @@ f_reciprocal(VALUE x)
static VALUE
nucomp_expt(VALUE self, VALUE other)
{
if (k_exact_zero_p(other))
if (k_numeric_p(other) && k_exact_zero_p(other))
return f_complex_new_bang1(CLASS_OF(self), ONE);
if (k_rational_p(other) && f_one_p(f_denominator(other)))

View file

@ -1,5 +1,5 @@
/*
rational.c: Coded by Tadayoshi Funaba 2008,2009
rational.c: Coded by Tadayoshi Funaba 2008-2010
This implementation is based on Keiju Ishitsuka's Rational library
which is written in ruby.
@ -929,7 +929,7 @@ nurat_fdiv(VALUE self, VALUE other)
static VALUE
nurat_expt(VALUE self, VALUE other)
{
if (k_exact_zero_p(other))
if (k_numeric_p(other) && k_exact_zero_p(other))
return f_rational_new_bang1(CLASS_OF(self), ONE);
if (k_rational_p(other)) {