diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-10 12:20:49 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-10 12:20:49 +0000 |
commit | bbb5a6d6f741be235abccff4da4cc424085869e6 (patch) | |
tree | ff9064a306fb61593010cf8d5ab561b07af423a1 | |
parent | e6f6033b16a64eb04f2e8c3ea970356a61ac1621 (diff) | |
download | ruby-bbb5a6d6f741be235abccff4da4cc424085869e6.tar.gz |
* complex.c (nucomp_to_[ifr]): don't allow complex with in-exact
imaginary zero to be converted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | complex.c | 6 |
2 files changed, 8 insertions, 3 deletions
@@ -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. @@ -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)); |