[Numpy-svn] r5883 - branches/clean_math_config_chuck/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Tue Sep 30 10:23:47 CDT 2008


Author: charris
Date: 2008-09-30 10:23:44 -0500 (Tue, 30 Sep 2008)
New Revision: 5883

Modified:
   branches/clean_math_config_chuck/numpy/core/src/umathmodule.c.src
Log:
For David to test.

Modified: branches/clean_math_config_chuck/numpy/core/src/umathmodule.c.src
===================================================================
--- branches/clean_math_config_chuck/numpy/core/src/umathmodule.c.src	2008-09-30 04:40:13 UTC (rev 5882)
+++ branches/clean_math_config_chuck/numpy/core/src/umathmodule.c.src	2008-09-30 15:23:44 UTC (rev 5883)
@@ -995,25 +995,16 @@
 
 /**begin repeat1
  * #kind = maximum, minimum#
- * #OP1 =  >=, <=#
- * #OP2 =  <=, >=#
+ * #OP =  >, <#
  **/
 static void
 @TYPE@_@kind@(char **args, intp *dimensions, intp *steps, void *func)
 {
-    /* Return NaN if either value is NaN */
+    /*  */
     BINARY_LOOP {
         const @type@ in1 = *(@type@ *)ip1;
         const @type@ in2 = *(@type@ *)ip2;
-        if (in1 @OP1@ in2) {
-            *((@type@ *)op) = in1;
-        }
-        else if (in1 @OP2@ in2) {
-            *((@type@ *)op) = in2;
-        }
-        else {
-            *((@type@ *)op) = NAN;
-        }
+        *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2;
     }
 }
 /**end repeat1**/
@@ -1102,7 +1093,7 @@
 static void
 @TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func)
 {
-    /* Returns NaN as sign of NaN */
+    /*  */
     UNARY_LOOP {
         const @type@ in1 = *(@type@ *)ip1;
         if (in1 > 0) {
@@ -1111,13 +1102,9 @@
         else if (in1 < 0) {
             *((@type@ *)op) = -1;
         }
-        else if (in1 == 0) {
+        else {
             *((@type@ *)op) = 0;
         }
-        else {
-            /* is NaN */
-            *((@type@ *)op) = in1;
-        }
     }
 }
 
@@ -1396,14 +1383,22 @@
     UNARY_LOOP {
         const @type@ in1r = ((@type@ *)ip1)[0];
         const @type@ in1i = ((@type@ *)ip1)[1];
-        if (in1r != 0) {
-            ((@type@ *)op)[0] = in1r > 0 ? 1 : -1;
+        if (in1r > 0) {
+            ((@type@ *)op)[0] = 1;
         }
-        else if (in1i != 0) {
-            ((@type@ *)op)[0] = in1i > 0 ? 1 : -1;
+        else if (in1r < 0) {
+            ((@type@ *)op)[0] = -1;
         }
         else {
-            ((@type@ *)op)[0] = 0;
+            if (in1i > 0) {
+                ((@type@ *)op)[0] = 1;
+            }
+            else if (in1i < 0) {
+                ((@type@ *)op)[0] = -1;
+            }
+            else {
+                ((@type@ *)op)[0] = 0;
+            }
         }
         ((@type@ *)op)[1] = 0;
     }



More information about the Numpy-svn mailing list