[Numpy-svn] r3771 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Thu May 17 06:13:42 EDT 2007


Author: oliphant
Date: 2007-05-17 05:13:39 -0500 (Thu, 17 May 2007)
New Revision: 3771

Modified:
   trunk/numpy/core/src/scalarmathmodule.c.src
Log:
Propagate changes made to umathmodule.c to fix the problem with division and remainder not being consistent for negative numbers.

Modified: trunk/numpy/core/src/scalarmathmodule.c.src
===================================================================
--- trunk/numpy/core/src/scalarmathmodule.c.src	2007-05-17 07:23:17 UTC (rev 3770)
+++ trunk/numpy/core/src/scalarmathmodule.c.src	2007-05-17 10:13:39 UTC (rev 3771)
@@ -218,7 +218,14 @@
     }
 #endif
     else {
+#if @neg@
+        @name@ tmp;
+        tmp = a / b;
+        if (((a > 0) != (b > 0)) && (a % b != 0)) tmp--;
+        *out = tmp;
+#else
 	*out = a / b;
+#endif
     }
 }
 #define @name at _ctype_floor_divide @name at _ctype_divide




More information about the Numpy-svn mailing list