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

numpy-svn@scip... numpy-svn@scip...
Sat Sep 13 02:27:29 CDT 2008


Author: cdavid
Date: 2008-09-13 02:27:25 -0500 (Sat, 13 Sep 2008)
New Revision: 5815

Modified:
   branches/clean_math_config/numpy/core/src/math_c99.c
Log:
Update generated math_c99 compat module.

Modified: branches/clean_math_config/numpy/core/src/math_c99.c
===================================================================
--- branches/clean_math_config/numpy/core/src/math_c99.c	2008-09-13 07:25:51 UTC (rev 5814)
+++ branches/clean_math_config/numpy/core/src/math_c99.c	2008-09-13 07:27:25 UTC (rev 5815)
@@ -11,14 +11,16 @@
  * vim:syntax=c
  * A small module to implement missing C99 math capabilities required by numpy
  *
- * Please keep this independant of python as much as possible !
+ * Please keep this independant of python !
  */
 
 /*
- * Basic functions, double version. Some old/weird platforms may not have those
- *
- * Original code by Konrad Hinsen.
+ *****************************************************************************
+ **                     BASIC MATH FUNCTIONS                                **
+ *****************************************************************************
  */
+
+/* Original code by Konrad Hinsen.  */
 #ifndef HAVE_EXPM1
 double expm1(double x)
 {
@@ -138,6 +140,74 @@
 #endif
 
 /*
+ *****************************************************************************
+ **                     IEEE 754 FPU HANDLING                               **
+ *****************************************************************************
+ */
+#if !defined(HAVE_DECL_ISNAN)
+    # define isnan(x) \
+              (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
+               : sizeof (x) == sizeof (double) ? isnan_d (x) \
+               : isnan_f (x))
+static int isnan_f  (float x) 
+{ 
+    return x != x; 
+}
+
+static int isnan_d  (double x) 
+{ 
+    return x != x; 
+}
+
+static int isnan_ld  (long double x) 
+{ 
+    return x != x; 
+}
+ 
+#if !defined(HAVE_DECL_ISINF)
+    # define isinf(x) \
+              (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
+               : sizeof (x) == sizeof (double) ? isinf_d (x) \
+               : isinf_f (x))
+
+static int isinf_f (float x) 
+{ 
+    return isnan (x - x); 
+}
+
+static int isinf_d (double x) 
+{ 
+    return isnan (x - x); 
+}
+
+static int isinf_ld (long double x) 
+{ 
+    return isnan (x - x);
+}
+
+#if !defined(HAVE_DECL_SIGNBIT)
+    #include "_signbit.c"
+    # define signbit(x) \
+              (sizeof (x) == sizeof (long double) ? signbit_ld (x) \
+               : sizeof (x) == sizeof (double) ? signbit_d (x) \
+               : signbit_f (x))
+
+static int signbit_f (float x) 
+{ 
+    return signbit_d((double)x); 
+}
+
+static int signbit_ld (long double x) 
+{ 
+    return signbit_d((double)x); 
+}
+
+/* Define isfinie if needed */
+#if !defined(HAVE_DECL_ISFINITE)
+#define isfinite(x) (!(isinf((x)) || isnan((x))))
+#endif
+
+/*
  * if C99 extensions not available then define dummy functions that use the
  * double versions for
  *
@@ -157,7 +227,7 @@
  * One value argument function
  */
 
-#line 160
+#line 230
 
 #ifndef HAVE_SINL
 longdouble sinl(longdouble x)
@@ -166,7 +236,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_COSL
 longdouble cosl(longdouble x)
@@ -175,7 +245,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TANL
 longdouble tanl(longdouble x)
@@ -184,7 +254,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_SINHL
 longdouble sinhl(longdouble x)
@@ -193,7 +263,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_COSHL
 longdouble coshl(longdouble x)
@@ -202,7 +272,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TANHL
 longdouble tanhl(longdouble x)
@@ -211,7 +281,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_FABSL
 longdouble fabsl(longdouble x)
@@ -220,7 +290,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_FLOORL
 longdouble floorl(longdouble x)
@@ -229,7 +299,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_CEILL
 longdouble ceill(longdouble x)
@@ -238,7 +308,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_RINTL
 longdouble rintl(longdouble x)
@@ -247,7 +317,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TRUNCL
 longdouble truncl(longdouble x)
@@ -256,7 +326,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_SQRTL
 longdouble sqrtl(longdouble x)
@@ -265,7 +335,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_LOG10L
 longdouble log10l(longdouble x)
@@ -274,7 +344,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_LOGL
 longdouble logl(longdouble x)
@@ -283,7 +353,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_EXPL
 longdouble expl(longdouble x)
@@ -292,7 +362,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_EXPM1L
 longdouble expm1l(longdouble x)
@@ -301,7 +371,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ASINL
 longdouble asinl(longdouble x)
@@ -310,7 +380,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ACOSL
 longdouble acosl(longdouble x)
@@ -319,7 +389,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ATANL
 longdouble atanl(longdouble x)
@@ -328,7 +398,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ASINHL
 longdouble asinhl(longdouble x)
@@ -337,7 +407,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ACOSHL
 longdouble acoshl(longdouble x)
@@ -346,7 +416,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ATANHL
 longdouble atanhl(longdouble x)
@@ -355,7 +425,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_SINF
 float sinf(float x)
@@ -364,7 +434,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_COSF
 float cosf(float x)
@@ -373,7 +443,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TANF
 float tanf(float x)
@@ -382,7 +452,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_SINHF
 float sinhf(float x)
@@ -391,7 +461,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_COSHF
 float coshf(float x)
@@ -400,7 +470,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TANHF
 float tanhf(float x)
@@ -409,7 +479,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_FABSF
 float fabsf(float x)
@@ -418,7 +488,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_FLOORF
 float floorf(float x)
@@ -427,7 +497,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_CEILF
 float ceilf(float x)
@@ -436,7 +506,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_RINTF
 float rintf(float x)
@@ -445,7 +515,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_TRUNCF
 float truncf(float x)
@@ -454,7 +524,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_SQRTF
 float sqrtf(float x)
@@ -463,7 +533,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_LOG10F
 float log10f(float x)
@@ -472,7 +542,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_LOGF
 float logf(float x)
@@ -481,7 +551,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_EXPF
 float expf(float x)
@@ -490,7 +560,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_EXPM1F
 float expm1f(float x)
@@ -499,7 +569,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ASINF
 float asinf(float x)
@@ -508,7 +578,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ACOSF
 float acosf(float x)
@@ -517,7 +587,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ATANF
 float atanf(float x)
@@ -526,7 +596,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ASINHF
 float asinhf(float x)
@@ -535,7 +605,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ACOSHF
 float acoshf(float x)
@@ -544,7 +614,7 @@
 }
 #endif
 
-#line 160
+#line 230
 
 #ifndef HAVE_ATANHF
 float atanhf(float x)
@@ -558,7 +628,7 @@
  * Two values arguments function
  */
 
-#line 182
+#line 252
 #ifndef HAVE_ATAN2L
 longdouble atan2l(longdouble x, longdouble y)
 {
@@ -566,7 +636,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_HYPOTL
 longdouble hypotl(longdouble x, longdouble y)
 {
@@ -574,7 +644,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_POWL
 longdouble powl(longdouble x, longdouble y)
 {
@@ -582,7 +652,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_FMODL
 longdouble fmodl(longdouble x, longdouble y)
 {
@@ -590,7 +660,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_ATAN2F
 float atan2f(float x, float y)
 {
@@ -598,7 +668,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_HYPOTF
 float hypotf(float x, float y)
 {
@@ -606,7 +676,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_POWF
 float powf(float x, float y)
 {
@@ -614,7 +684,7 @@
 }
 #endif
 
-#line 182
+#line 252
 #ifndef HAVE_FMODF
 float fmodf(float x, float y)
 {
@@ -627,7 +697,7 @@
  * One value - one pointer argument function
  */
 
-#line 202
+#line 272
 #ifndef HAVE_MODFL
 longdouble modfl(longdouble x, longdouble *iptr)
 {
@@ -639,7 +709,7 @@
 }
 #endif
 
-#line 202
+#line 272
 #ifndef HAVE_MODFF
 float modff(float x, float *iptr)
 {



More information about the Numpy-svn mailing list