summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--complex.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 79efcae520..811946901f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Aug 10 21:18:04 2010 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact
+ imaginary zero to be converted.
+
Tue Aug 10 20:56:31 2010 Tanaka Akira <akr@fsij.org>
* lib/optparse.rb: suppress a warning.
diff --git a/complex.c b/complex.c
index 1052c0c458..b88f6b980b 100644
--- a/complex.c
+++ b/complex.c
@@ -1296,7 +1296,7 @@ nucomp_to_i(VALUE self)
{
get_dat1(self);
- if (f_nonzero_p(dat->imag)) {
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Integer",
StringValuePtr(s));
@@ -1315,7 +1315,7 @@ nucomp_to_f(VALUE self)
{
get_dat1(self);
- if (f_nonzero_p(dat->imag)) {
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Float",
StringValuePtr(s));
@@ -1334,7 +1334,7 @@ nucomp_to_r(VALUE self)
{
get_dat1(self);
- if (f_nonzero_p(dat->imag)) {
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Rational",
StringValuePtr(s));