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

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Nov 12 06:28:16 EST 2008


Author: charris
Date: 2008-11-12 05:28:11 -0600 (Wed, 12 Nov 2008)
New Revision: 6018

Modified:
   trunk/numpy/core/src/math_c99.inc.src
Log:
Another stab at MSVC voodoo.

Modified: trunk/numpy/core/src/math_c99.inc.src
===================================================================
--- trunk/numpy/core/src/math_c99.inc.src	2008-11-12 09:28:30 UTC (rev 6017)
+++ trunk/numpy/core/src/math_c99.inc.src	2008-11-12 11:28:11 UTC (rev 6018)
@@ -7,49 +7,11 @@
 
 /*
  *****************************************************************************
- **                     C99 PROTOTYPES                                      **
+ **                     DISTRO VOODOO                                       **
  *****************************************************************************
  */
 
-#ifndef _MSC_VER
 
-/**begin repeat
- * #type = float, double, longdouble#
- * #c = f, ,l#
- */
-
-/**begin repeat1
- * #kind = sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,rint,trunc,sqrt,log10,
- *         log,exp,expm1,asin,acos,atan,asinh,acosh,atanh,log1p,exp2,log2,
- *         logb#
- */
-
- at type@ @kind@@c@(@type@ x);
-
-/**end repeat1**/
-
-/**begin repeat1
- * #kind = atan2,hypot,pow,fmod,scalb#
- */
-
- at type@ @kind@@c@(@type@ x, @type@ y);
-
-/**end repeat1**/
-
- at type@ modf at c@(@type@ x, @type@ *iptr);
- at type@ ldexp at c@(@type@ x, int iexp);
- at type@ frexp at c@(@type@ x, int *iptr);
- at type@ scalbn at c@(@type@ x, int pow);
- at type@ scalbln at c@(@type@ x, long pow);
-
-/**end repeat**/
-
-#else
-#include <xmath.h>
-#define HAVE_TANHF
-
-#endif
-
 /*
  *****************************************************************************
  **                     BASIC MATH FUNCTIONS                                **
@@ -58,7 +20,7 @@
 
 /* Original code by Konrad Hinsen.  */
 #ifndef HAVE_EXPM1
-static double expm1(double x)
+double expm1(double x)
 {
     double u = exp(x);
     if (u == 1.0) {
@@ -69,10 +31,12 @@
         return (u-1.0) * x/log(u);
     }
 }
+#else
+double expm1(double x);
 #endif
 
 #ifndef HAVE_LOG1P
-static double log1p(double x)
+double log1p(double x)
 {
     double u = 1. + x;
     if (u == 1.0) {
@@ -81,10 +45,12 @@
         return log(u) * x / (u - 1);
     }
 }
+#else
+double log1p(double x);
 #endif
 
 #ifndef HAVE_HYPOT
-static double hypot(double x, double y)
+double hypot(double x, double y)
 {
     double yx;
 
@@ -102,17 +68,21 @@
         return x*sqrt(1.+yx*yx);
     }
 }
+#else
+double hypot(double x, double y);
 #endif
 
 #ifndef HAVE_ACOSH
-static double acosh(double x)
+double acosh(double x)
 {
     return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2));
 }
+#else
+double acosh(double x);
 #endif
 
 #ifndef HAVE_ASINH
-static double asinh(double xx)
+double asinh(double xx)
 {
     double x, d;
     int sign;
@@ -131,17 +101,21 @@
     }
     return sign*log1p(x*(1.0 + x/(d+1)));
 }
+#else
+double asinh(double xx);
 #endif
 
 #ifndef HAVE_ATANH
-static double atanh(double x)
+double atanh(double x)
 {
     return 0.5*log1p(2.0*x/(1.0-x));
 }
+#else
+double atanh(double x);
 #endif
 
 #ifndef HAVE_RINT
-static double rint(double x)
+double rint(double x)
 {
     double y, r;
 
@@ -160,31 +134,39 @@
     }
     return y;
 }
+#else
+double rint(double x);
 #endif
 
 #ifndef HAVE_TRUNC
-static double trunc(double x)
+double trunc(double x)
 {
     return x < 0 ? ceil(x) : floor(x);
 }
+#else
+double trunc(double x);
 #endif
 
 #ifndef HAVE_EXP2
 #define LOG2 0.69314718055994530943
-static double exp2(double x)
+double exp2(double x)
 {
     return exp(LOG2*x);
 }
 #undef LOG2
+#else
+double exp2(double x);
 #endif
 
 #ifndef HAVE_LOG2
 #define INVLOG2 1.4426950408889634074
-static double log2(double x)
+double log2(double x)
 {
     return INVLOG2*log(x);
 }
 #undef INVLOG2
+#else
+double log2(double x);
 #endif
 
 /*
@@ -257,43 +239,54 @@
  * #KIND = SIN,COS,TAN,SINH,COSH,TANH,FABS,FLOOR,CEIL,RINT,TRUNC,SQRT,LOG10,
  *         LOG,EXP,EXPM1,ASIN,ACOS,ATAN,ASINH,ACOSH,ATANH,LOG1P,EXP2,LOG2#
  */
-#ifndef HAVE_ at KIND@@C@
+
 #ifdef @kind@@c@
 #undef @kind@@c@
 #endif
-static @type@ @kind@@c@(@type@ x)
+#ifndef HAVE_ at KIND@@C@
+ at type@ npy_ at kind@@c@(@type@ x)
 {
     return (@type@) @kind@((double)x);
 }
+#define @kind@@c@  npy_ at kind@@c@
+#else
+ at type@ @kind@@c@(@type@ x);
 #endif
+
 /**end repeat1**/
 
 /**begin repeat1
  * #kind = atan2,hypot,pow,fmod#
  * #KIND = ATAN2,HYPOT,POW,FMOD#
  */
-#ifndef HAVE_ at KIND@@C@
 #ifdef @kind@@c@
 #undef @kind@@c@
 #endif
-static @type@ @kind@@c@(@type@ x, @type@ y)
+#ifndef HAVE_ at KIND@@C@
+ at type@ npy_ at kind@@c@(@type@ x, @type@ y)
 {
     return (@type@) @kind@((double)x, (double) y);
 }
+#define @kind@@c@  npy_ at kind@@c@
+#else
+ at type@ @kind@@c@(@type@ x, @type@ y);
 #endif
 /**end repeat1**/
 
-#ifndef HAVE_MODF at C@
 #ifdef modf at c@
 #undef modf at c@
 #endif
-static @type@ modf at c@(@type@ x, @type@ *iptr)
+#ifndef HAVE_MODF at C@
+ at type@ npy_modf at c@(@type@ x, @type@ *iptr)
 {
     double niptr;
     double y = modf((double)x, &niptr);
     *iptr = (@type@) niptr;
     return (@type@) y;
 }
+#define modf at c@ npy_modf at c@
+#else
+ at type@ modf at c@(@type@ x, @type@ *iptr);
 #endif
 
 /**end repeat**/




More information about the Numpy-svn mailing list