[Python-checkins] r60829 - python/branches/trunk-math/Objects/complexobject.c

christian.heimes python-checkins at python.org
Fri Feb 15 08:13:09 CET 2008


Author: christian.heimes
Date: Fri Feb 15 08:13:08 2008
New Revision: 60829

Modified:
   python/branches/trunk-math/Objects/complexobject.c
Log:
Use copysign

Modified: python/branches/trunk-math/Objects/complexobject.c
==============================================================================
--- python/branches/trunk-math/Objects/complexobject.c	(original)
+++ python/branches/trunk-math/Objects/complexobject.c	Fri Feb 15 08:13:08 2008
@@ -325,8 +325,7 @@
 		if (!Py_IS_FINITE(v->cval.imag)) {
 			if (Py_IS_NAN(v->cval.imag))
 				strncpy(buf, "nan*j", 6);
-			/* else if (copysign(1, v->cval.imag) == 1) */
-			else if (v->cval.imag > 0)
+			else if (copysign(1, v->cval.imag) == 1)
 				strncpy(buf, "inf*j", 6);
 			else
 				strncpy(buf, "-inf*j", 7);
@@ -342,8 +341,7 @@
 		if (!Py_IS_FINITE(v->cval.real)) {
 			if (Py_IS_NAN(v->cval.real))
 				strncpy(re, "nan", 4);
-			/* else if (copysign(1, v->cval.real) == 1) */
-			else if (v->cval.real > 0)
+			else if (copysign(1, v->cval.real) == 1)
 				strncpy(re, "inf", 4);
 			else
 				strncpy(re, "-inf", 5);
@@ -355,8 +353,7 @@
 		if (!Py_IS_FINITE(v->cval.imag)) {
 			if (Py_IS_NAN(v->cval.imag))
 				strncpy(im, "+nan*", 6);
-			/* else if (copysign(1, v->cval.imag) == 1) */
-			else if (v->cval.imag > 0)
+			else if (copysign(1, v->cval.imag) == 1)
 				strncpy(im, "+inf*", 6);
 			else
 				strncpy(im, "-inf*", 6);


More information about the Python-checkins mailing list