[Numpy-svn] r5393 - trunk/numpy/core/src
numpy-svn at scipy.org
numpy-svn at scipy.org
Sat Jul 12 01:17:46 EDT 2008
Author: charris
Date: 2008-07-12 00:17:43 -0500 (Sat, 12 Jul 2008)
New Revision: 5393
Modified:
trunk/numpy/core/src/scalartypes.inc.src
Log:
Small cleanups.
Modified: trunk/numpy/core/src/scalartypes.inc.src
===================================================================
--- trunk/numpy/core/src/scalartypes.inc.src 2008-07-12 05:14:39 UTC (rev 5392)
+++ trunk/numpy/core/src/scalartypes.inc.src 2008-07-12 05:17:43 UTC (rev 5393)
@@ -551,11 +551,10 @@
return ret;
}
/**begin repeat
-
-#name=float, double, longdouble#
-#NAME=FLOAT, DOUBLE, LONGDOUBLE#
-#PREFIX=NPY_,NPY_,NPY_#
-*/
+ * #name=float, double, longdouble#
+ * #NAME=FLOAT, DOUBLE, LONGDOUBLE#
+ * #PREFIX=NPY_,NPY_,NPY_#
+ */
static void
format_ at name@(char *buf, size_t buflen, @name@ val,
unsigned int precision)
@@ -640,8 +639,9 @@
@name at type_@kind@(PyObject *self)
{
static char buf[100];
- format_ at name@(buf, sizeof(buf),
- ((Py at Name@ScalarObject *)self)->obval, @NAME at PREC_@KIND@);
+ @name@ x = ((Py at Name@ScalarObject *)self)->obval;
+
+ format_ at name@(buf, sizeof(buf), x, @NAME at PREC_@KIND@);
return PyString_FromString(buf);
}
@@ -651,11 +651,10 @@
static char buf1[100];
static char buf2[100];
static char buf3[202];
- c at name@ x;
- x = ((PyC at Name@ScalarObject *)self)->obval;
+ c at name@ x = ((PyC at Name@ScalarObject *)self)->obval;
+
format_ at name@(buf1, sizeof(buf1), x.real, @NAME at PREC_@KIND@);
format_ at name@(buf2, sizeof(buf2), x.imag, @NAME at PREC_@KIND@);
-
snprintf(buf3, sizeof(buf3), "(%s+%sj)", buf1, buf2);
return PyString_FromString(buf3);
}
@@ -2696,8 +2695,8 @@
PyCLongDoubleArrType_Type.tp_as_number = &clongdoubletype_as_number;
/**begin repeat
-#name=int, long, hex, oct, float, repr, str#
-#kind=tp_as_number->nb*5, tp*2#
+ * #name=int, long, hex, oct, float, repr, str#
+ * #kind=tp_as_number->nb*5, tp*2#
*/
PyLongDoubleArrType_Type. at kind@_ at name@ = longdoubletype_ at name@;
PyCLongDoubleArrType_Type. at kind@_ at name@ = clongdoubletype_ at name@;
More information about the Numpy-svn
mailing list