summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--complex.c4
-rw-r--r--rational.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5cdf1ccb14..73e62c2780 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/complex.c b/complex.c
index 4bc3005cff..58b900b421 100644
--- a/complex.c
+++ b/complex.c
@@ -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)))
diff --git a/rational.c b/rational.c
index 9334b14352..2aec3e264a 100644
--- a/rational.c
+++ b/rational.c
@@ -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)) {