[Numpy-svn] r5702 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Mon Aug 25 17:06:11 CDT 2008


Author: cdavid
Date: 2008-08-25 17:06:08 -0500 (Mon, 25 Aug 2008)
New Revision: 5702

Modified:
   trunk/numpy/lib/ufunclike.py
Log:
Use trunc as fix implementation.


Modified: trunk/numpy/lib/ufunclike.py
===================================================================
--- trunk/numpy/lib/ufunclike.py	2008-08-25 22:06:00 UTC (rev 5701)
+++ trunk/numpy/lib/ufunclike.py	2008-08-25 22:06:08 UTC (rev 5702)
@@ -11,17 +11,8 @@
 def fix(x, y=None):
     """ Round x to nearest integer towards zero.
     """
-    x = asanyarray(x)
-    if y is None:
-        y = nx.floor(x)
-    else:
-        nx.floor(x, y)
-    if x.ndim == 0:
-        if (x<0):
-            y += 1
-    else:
-        y[x<0] = y[x<0]+1
-    return y
+    # fix is now implemented in C, using the C99 trunc function.
+    return umath.trunc(x, y)
 
 def isposinf(x, y=None):
     """



More information about the Numpy-svn mailing list