summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-08-25 22:05:21 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-08-25 22:05:21 +0000
commit5b38878bd94d755d72441cf1849a433b6971dd6c (patch)
treea01e1a3f1bcb3a0a32d7d03bba7edb571b91151c /numpy/core/src
parent654da295908331c585e1e0845929e2146dcc1e9d (diff)
downloadnumpy-5b38878bd94d755d72441cf1849a433b6971dd6c.tar.gz
Add pure C trunc function implementations for platform which do not have it.
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/umathmodule.c.src22
1 files changed, 18 insertions, 4 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src
index 9096cdbf1..6bc26f2d0 100644
--- a/numpy/core/src/umathmodule.c.src
+++ b/numpy/core/src/umathmodule.c.src
@@ -326,6 +326,20 @@ rint (double x)
}
#endif
+#ifndef HAVE_TRUNC
+static double
+trunc (double x)
+{
+ double y, r;
+
+ if (x < 0) {
+ return - floor(-x);
+ } else {
+ return x;
+ }
+
+}
+#endif
@@ -461,10 +475,10 @@ longdouble radiansl(longdouble x) {
/**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