mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
e6f6033b16
commit
bbb5a6d6f7
2 changed files with 8 additions and 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));
|
||||
|
|
Loading…
Reference in a new issue