[Python-checkins] python/dist/src/Objects complexobject.c, 2.72.2.1, 2.72.2.2

birkenfeld@users.sourceforge.net birkenfeld at users.sourceforge.net
Fri Sep 16 08:42:36 CEST 2005


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25841/Objects

Modified Files:
      Tag: release24-maint
	complexobject.c 
Log Message:
backport patch [ 1118729 ] Error in representation of complex numbers(again)



Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.72.2.1
retrieving revision 2.72.2.2
diff -u -d -r2.72.2.1 -r2.72.2.2
--- complexobject.c	19 Dec 2004 20:47:25 -0000	2.72.2.1
+++ complexobject.c	16 Sep 2005 06:42:32 -0000	2.72.2.2
@@ -279,15 +279,12 @@
 		strncat(buf, "j", bufsz);
 	} else {
 		char re[64], im[64];
-		char *fmt;
+		/* Format imaginary part with sign, real part without */
 		PyOS_snprintf(format, 32, "%%.%ig", precision);
 		PyOS_ascii_formatd(re, 64, format, v->cval.real);
+		PyOS_snprintf(format, 32, "%%+.%ig", precision);
 		PyOS_ascii_formatd(im, 64, format, v->cval.imag);
-		if (v->cval.imag < 0.)
-			fmt = "(%s%sj)";
-		else
-			fmt = "(%s+%sj)";
-		PyOS_snprintf(buf, bufsz, fmt, re, im);
+		PyOS_snprintf(buf, bufsz, "(%s%sj)", re, im);
 	}
 }
 



More information about the Python-checkins mailing list