Skip to content

Commit

Permalink
* complex.c (nucomp_to_[ifr]): don't allow complex with in-exact
Browse files Browse the repository at this point in the history
	  imaginary zero to be converted.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
tadf committed Aug 10, 2010
1 parent e6f6033 commit bbb5a6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Tue Aug 10 21:18:04 2010 Tadayoshi Funaba <[email protected]>

* 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 <[email protected]>

* lib/optparse.rb: suppress a warning.
Expand Down
6 changes: 3 additions & 3 deletions complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit bbb5a6d

Please sign in to comment.