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

numpy-svn@scip... numpy-svn@scip...
Mon Aug 25 17:05:24 CDT 2008


Author: cdavid
Date: 2008-08-25 17:05:21 -0500 (Mon, 25 Aug 2008)
New Revision: 5698

Modified:
   trunk/numpy/core/src/umathmodule.c.src
Log:
Add pure C trunc function implementations for platform which do not have it.


Modified: trunk/numpy/core/src/umathmodule.c.src
===================================================================
--- trunk/numpy/core/src/umathmodule.c.src	2008-08-25 22:05:06 UTC (rev 5697)
+++ trunk/numpy/core/src/umathmodule.c.src	2008-08-25 22:05:21 UTC (rev 5698)
@@ -326,10 +326,24 @@
 }
 #endif
 
+#ifndef HAVE_TRUNC
+static double
+trunc (double x)
+{
+    double y, r;
 
+    if (x < 0) {
+	return - floor(-x);
+    } else {
+        return x;
+    }
 
+}
+#endif
 
 
+
+
 /* Define isnan, isinf, isfinite, signbit if needed */
 /* Use fpclassify if possible */
 /* isnan, isinf --
@@ -461,10 +475,10 @@
 
 /**begin repeat
 
-   #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,sqrt,log10,log,exp,asin,acos,atan,rint)*2#
-   #typ=longdouble*17, float*17#
-   #c=l*17,f*17#
-   #TYPE=LONGDOUBLE*17, FLOAT*17#
+   #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,trunc,sqrt,log10,log,exp,asin,acos,atan,rint)*2#
+   #typ=longdouble*18, float*18#
+   #c=l*18,f*18#
+   #TYPE=LONGDOUBLE*18, FLOAT*18#
 */
 
 #ifndef HAVE_@TYPE@_FUNCS



More information about the Numpy-svn mailing list