[Numpy-svn] r5758 - branches/clean_math_config/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Thu Sep 4 09:35:55 CDT 2008


Author: cdavid
Date: 2008-09-04 09:35:51 -0500 (Thu, 04 Sep 2008)
New Revision: 5758

Modified:
   branches/clean_math_config/numpy/core/src/math_c99.c
Log:
Use code generator for c99_math.c

Modified: branches/clean_math_config/numpy/core/src/math_c99.c
===================================================================
--- branches/clean_math_config/numpy/core/src/math_c99.c	2008-09-04 13:58:47 UTC (rev 5757)
+++ branches/clean_math_config/numpy/core/src/math_c99.c	2008-09-04 14:35:51 UTC (rev 5758)
@@ -141,362 +141,79 @@
  *
  * sin, cos, tan
  * sinh, cosh, tanh,
- * fabs, floor, ceil, fmod, sqrt, log10, log, exp, fabs
+ * fabs, floor, ceil, rint, trunc
+ * sqrt, log10, log, exp
  * asin, acos, atan,
  * asinh, acosh, atanh
  *
- * hypot, atan2, pow, expm1
+ * hypot, atan2, pow, fmod, modf
  *
  * We assume the above are always available in their double versions.
  */
 
-/*
- * Long double versions
+/* 
+ * One value argument function
  */
-#ifndef HAVE_SINL
-longdouble sinl(longdouble x)
-{
-    return (longdouble) sin((double)x);
-}
-#endif
 
-#ifndef HAVE_COSL
-longdouble cosl(longdouble x)
-{
-    return (longdouble) cos((double)x);
-}
-#endif
+/**begin repeat
 
-#ifndef HAVE_TANL
-longdouble tanl(longdouble x)
-{
-    return (longdouble) tan((double)x);
-}
-#endif
+   #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,rint,trunc,sqrt,log10,log,exp,asin,acos,atan,asinh,acosh,atanh)*2#
+   #KIND=(SIN,COS,TAN,SINH,COSH,TANH,FABS,FLOOR,CEIL,RINT,TRUNC,SQRT,LOG10,LOG,EXP,ASIN,ACOS,ATAN,ASINH,ACOSH,ATANH)*2#
+   #typ=longdouble*21, float*21#
+   #c=l*21,f*21#
+   #C=L*21,F*21#
+   #TYPE=LONGDOUBLE*21, FLOAT*21#
+*/
 
-#ifndef HAVE_SINHL
-longdouble sinhl(longdouble x)
+#ifndef HAVE_@KIND@@C@
+@typ@ @kind@@c@(@typ@ x) 
 {
-    return (longdouble) sinh((double)x);
+    return (@typ@) @kind@((double)x);
 }
 #endif
+/**end repeat**/
 
-#ifndef HAVE_COSHL
-longdouble coshl(longdouble x)
-{
-    return (longdouble) cosh((double)x);
-}
-#endif
+/* 
+ * Two values arguments function
+ */
 
-#ifndef HAVE_TANHL
-longdouble tanhl(longdouble x)
-{
-    return (longdouble) tanh((double)x);
-}
-#endif
+/**begin repeat
 
-#ifndef HAVE_FABSL
-longdouble fabsl(longdouble x)
+   #kind=(atan2,hypot,pow,fmod)*2#
+   #KIND=(ATAN2,HYPOT,POW,FMOD)*2#
+   #typ=longdouble*4, float*4#
+   #c=l*4,f*4#
+   #C=L*4,F*4#
+   #TYPE=LONGDOUBLE*4,FLOAT*4#
+*/
+#ifndef HAVE_@KIND@@C@
+@typ@ @kind@@c@(@typ@ x, @typ@ y) 
 {
-    return (longdouble) fabs((double)x);
+    return (@typ@) @kind@((double)x, (double) y);
 }
 #endif
+/**end repeat**/
 
-#ifndef HAVE_FLOORL
-longdouble floorl(longdouble x)
-{
-    return (longdouble) floor((double)x);
-}
-#endif
-
-#ifndef HAVE_CEILL
-longdouble ceill(longdouble x)
-{
-    return (longdouble) ceil((double)x);
-}
-#endif
-
-#ifndef HAVE_SQRTL
-longdouble sqrtl(longdouble x)
-{
-    return (longdouble) sqrt((double)x);
-}
-#endif
-
-#ifndef HAVE_LOG10L
-longdouble log10l(longdouble x)
-{
-    return (longdouble) log10((double)x);
-}
-#endif
-
-#ifndef HAVE_LOGL
-longdouble logl(longdouble x)
-{
-    return (longdouble) log((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPL
-longdouble expl(longdouble x)
-{
-    return (longdouble) exp((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPM1L
-longdouble expm1l(longdouble x)
-{
-    return (longdouble) expm1((double)x);
-}
-#endif
-
-#ifndef HAVE_ASINL
-longdouble asinl(longdouble x)
-{
-    return (longdouble) asin((double)x);
-}
-#endif
-
-#ifndef HAVE_ACOSL
-longdouble acosl(longdouble x)
-{
-    return (longdouble) acos((double)x);
-}
-#endif
-
-#ifndef HAVE_ATANL
-longdouble atanl(longdouble x)
-{
-    return (longdouble) atan((double)x);
-}
-#endif
-
-#ifndef HAVE_RINTL
-longdouble rintl(longdouble x)
-{
-    return (longdouble) rint((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPML
-longdouble expml(longdouble x)
-{
-    return (longdouble) expm((double)x);
-}
-#endif
-
-#ifndef HAVE_ATAN2L
-longdouble atan2l(longdouble x, longdouble y)
-{
-    return (longdouble) atan2((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_HYPOTL
-longdouble hypotl(longdouble x, longdouble y)
-{
-    return (longdouble) hypot((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_POWL
-longdouble powl(longdouble x, longdouble y)
-{
-    return (longdouble) pow((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_FMODL
-longdouble fmodl(longdouble x, longdouble y)
-{
-    return (longdouble) fmod((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_MODFL
-longdouble modfl(longdouble x, longdouble *iptr)
-{
-    double nx, niptr, y;
-    nx = (double) x;
-    y = modf(nx, &niptr);
-    *iptr = (longdouble) niptr;
-    return (longdouble) y;
-}
-#endif
-
-/*
- * float versions
+/* 
+ * One value - one pointer argument function
  */
-#ifndef HAVE_SINF
-float sinf(float x)
-{
-    return (float) sin((double)x);
-}
-#endif
 
-#ifndef HAVE_COSF
-float cosf(float x)
+/**begin repeat
+   #kind=modf*2#
+   #KIND=MODF*2#
+   #c=l,f#
+   #C=L,F#
+   #typ=longdouble, float#
+   #TYPE=LONGDOUBLE, FLOAT#
+*/
+#ifndef HAVE_@KIND@@C@
+@typ@ modf@c@(@typ@ x, @typ@ *iptr) 
 {
-    return (float) cos((double)x);
-}
-#endif
-
-#ifndef HAVE_TANF
-float tanf(float x)
-{
-    return (float) tan((double)x);
-}
-#endif
-
-#ifndef HAVE_SINHF
-float sinhf(float x)
-{
-    return (float) sinh((double)x);
-}
-#endif
-
-#ifndef HAVE_COSHF
-float coshf(float x)
-{
-    return (float) cosh((double)x);
-}
-#endif
-
-#ifndef HAVE_TANHF
-float tanhf(float x)
-{
-    return (float) tanh((double)x);
-}
-#endif
-
-#ifndef HAVE_FABSF
-float fabsf(float x)
-{
-    return (float) fabs((double)x);
-}
-#endif
-
-#ifndef HAVE_FLOORF
-float floorf(float x)
-{
-    return (float) floor((double)x);
-}
-#endif
-
-#ifndef HAVE_CEILF
-float ceilf(float x)
-{
-    return (float) ceil((double)x);
-}
-#endif
-
-#ifndef HAVE_SQRTF
-float sqrtf(float x)
-{
-    return (float) sqrt((double)x);
-}
-#endif
-
-#ifndef HAVE_LOG10F
-float log10f(float x)
-{
-    return (float) log10((double)x);
-}
-#endif
-
-#ifndef HAVE_LOGF
-float logf(float x)
-{
-    return (float) log((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPF
-float expf(float x)
-{
-    return (float) exp((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPM1F
-float expm1f(float x)
-{
-    return (float) expm1((double)x);
-}
-#endif
-
-#ifndef HAVE_ASINF
-float asinf(float x)
-{
-    return (float) asin((double)x);
-}
-#endif
-
-#ifndef HAVE_ACOSF
-float acosf(float x)
-{
-    return (float) acos((double)x);
-}
-#endif
-
-#ifndef HAVE_ATANF
-float atanf(float x)
-{
-    return (float) atan((double)x);
-}
-#endif
-
-#ifndef HAVE_RINTF
-float rintf(float x)
-{
-    return (float) rint((double)x);
-}
-#endif
-
-#ifndef HAVE_EXPMF
-float expmf(float x)
-{
-    return (float) expm((double)x);
-}
-#endif
-
-#ifndef HAVE_ATAN2F
-float atan2f(float x, float y)
-{
-    return (float) atan2((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_HYPOTF
-float hypotf(float x, float y)
-{
-    return (float) hypot((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_POWF
-float powf(float x, float y)
-{
-    return (float) pow((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_FMODF
-float fmodf(float x, float y)
-{
-    return (float) fmod((double)x, (double) y);
-}
-#endif
-
-#ifndef HAVE_MODFF
-float modff(float x, float *iptr)
-{
     double nx, niptr, y;
     nx = (double) x;
     y = modf(nx, &niptr);
-    *iptr = (float) niptr;
-    return (float) y;
+    *iptr = (@typ@) niptr;
+    return (@typ@) y;
 }
 #endif
-
+/**end repeat**/



More information about the Numpy-svn mailing list