* 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:
tadf 2010-08-10 12:20:49 +00:00
Родитель e6f6033b16
Коммит bbb5a6d6f7
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -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));