[前][次][番号順一覧][スレッド一覧]

ruby-changes:16959

From: tadf <ko1@a...>
Date: Tue, 10 Aug 2010 21:22:46 +0900 (JST)
Subject: [ruby-changes:16959] Ruby:r28955 (trunk): * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact

tadf	2010-08-10 21:20:49 +0900 (Tue, 10 Aug 2010)

  New Revision: 28955

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28955

  Log:
    * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact
      imaginary zero to be converted.

  Modified files:
    trunk/ChangeLog
    trunk/complex.c

Index: complex.c
===================================================================
--- complex.c	(revision 28954)
+++ complex.c	(revision 28955)
@@ -1296,7 +1296,7 @@
 {
     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 @@
 {
     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 @@
 {
     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));
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28954)
+++ ChangeLog	(revision 28955)
@@ -1,3 +1,8 @@
+Tue Aug 10 21:18:04 2010  Tadayoshi Funaba  <tadf@d...>
+
+	* 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@f...>
 
 	* lib/optparse.rb: suppress a warning.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]