Changeset: ddfd0a3c4ece for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ddfd0a3c4ece
Modified Files:
        monetdb5/extras/rapi/Makefile.ag
        monetdb5/extras/rapi/converters.c.h
        monetdb5/extras/rapi/rapi.c
        monetdb5/modules/kernel/mmath.c
        monetdb5/modules/kernel/mmath.h
        tools/embedded/Makefile.ag
        tools/embedded/embeddedr.c
Branch: embedded
Log Message:

isnan/isinf fix


diffs (177 lines):

diff --git a/monetdb5/extras/rapi/Makefile.ag b/monetdb5/extras/rapi/Makefile.ag
--- a/monetdb5/extras/rapi/Makefile.ag
+++ b/monetdb5/extras/rapi/Makefile.ag
@@ -9,6 +9,7 @@ INCLUDES = \
        ../../../common/stream \
        ../../../gdk \
        ../../mal \
+       ../../modules/kernel \
        ../../../sql/include \
        $(libr_CFLAGS)
 
diff --git a/monetdb5/extras/rapi/converters.c.h 
b/monetdb5/extras/rapi/converters.c.h
--- a/monetdb5/extras/rapi/converters.c.h
+++ b/monetdb5/extras/rapi/converters.c.h
@@ -184,7 +184,7 @@ static BAT* sexp_to_bat(SEXP s, int type
                if (!IS_NUMERIC(s)) {
                        return NULL;
                }
-               SXP_TO_BAT(dbl, NUMERIC_POINTER, (ISNA(*p) || isnan(*p) || 
isinf(*p)));
+               SXP_TO_BAT(dbl, NUMERIC_POINTER, (ISNA(*p) || MNisnan(*p) || 
MNisinf(*p)));
                break;
        }
        case TYPE_str: {
diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -16,6 +16,7 @@
 #include "mal_linker.h"
 #include "gdk_utils.h"
 #include "gdk.h"
+#include "mmath.h"
 #include "sql_catalog.h"
 #include "rapi.h"
 
diff --git a/monetdb5/modules/kernel/mmath.c b/monetdb5/modules/kernel/mmath.c
--- a/monetdb5/modules/kernel/mmath.c
+++ b/monetdb5/modules/kernel/mmath.c
@@ -26,49 +26,6 @@
 #define fetestexcept(x)                0
 #endif
 
-#ifdef _MSC_VER
-# include <float.h>
-#if _MSC_VER <= 1600
-/* Windows spells these differently */
-# define isnan(x)      _isnan(x)
-#endif
-# define finite(x)     _finite(x)
-/* NOTE: HAVE_FPCLASS assumed... */
-# define fpclass(x)    _fpclass(x)
-# define FP_NINF               _FPCLASS_NINF
-# define FP_PINF               _FPCLASS_PINF
-#else /* !_MSC_VER */
-# ifdef HAVE_IEEEFP_H
-#  include <ieeefp.h>
-# endif
-#endif
-
-#if defined(HAVE_FPCLASSIFY) || defined(fpclassify)
-/* C99 interface: fpclassify */
-# define MNisinf(x)            (fpclassify(x) == FP_INFINITE)
-# define MNisnan(x)            (fpclassify(x) == FP_NAN)
-# define MNfinite(x)   (!MNisinf(x) && !MNisnan(x))
-#else
-# define MNisnan(x)            isnan(x)
-# define MNfinite(x)   finite(x)
-# ifdef HAVE_ISINF
-#  define MNisinf(x)   isinf(x)
-# else
-static int
-MNisinf(double x)
-{
-#ifdef HAVE_FPCLASS
-       int cl = fpclass(x);
-
-       return ((cl == FP_NINF) || (cl == FP_PINF));
-#else
-       (void)x;
-       return 0;               /* XXX not correct if infinite */
-#endif
-}
-# endif
-#endif /* HAVE_FPCLASSIFY */
-
 #define cot(x)                         (1 / tan(x))
 #define radians(x)                     ((x) * 3.14159265358979323846 / 180.0)
 #define degrees(x)                     ((x) * 180.0 / 3.14159265358979323846)
diff --git a/monetdb5/modules/kernel/mmath.h b/monetdb5/modules/kernel/mmath.h
--- a/monetdb5/modules/kernel/mmath.h
+++ b/monetdb5/modules/kernel/mmath.h
@@ -15,6 +15,49 @@
 #include "mal_exception.h"
 #include <math.h>
 
+#ifdef _MSC_VER
+# include <float.h>
+#if _MSC_VER <= 1600
+/* Windows spells these differently */
+# define isnan(x)      _isnan(x)
+#endif
+# define finite(x)     _finite(x)
+/* NOTE: HAVE_FPCLASS assumed... */
+# define fpclass(x)    _fpclass(x)
+# define FP_NINF               _FPCLASS_NINF
+# define FP_PINF               _FPCLASS_PINF
+#else /* !_MSC_VER */
+# ifdef HAVE_IEEEFP_H
+#  include <ieeefp.h>
+# endif
+#endif
+
+#if defined(HAVE_FPCLASSIFY) || defined(fpclassify)
+/* C99 interface: fpclassify */
+# define MNisinf(x)            (fpclassify(x) == FP_INFINITE)
+# define MNisnan(x)            (fpclassify(x) == FP_NAN)
+# define MNfinite(x)   (!MNisinf(x) && !MNisnan(x))
+#else
+# define MNisnan(x)            isnan(x)
+# define MNfinite(x)   finite(x)
+# ifdef HAVE_ISINF
+#  define MNisinf(x)   isinf(x)
+# else
+static inline int
+MNisinf(double x)
+{
+#ifdef HAVE_FPCLASS
+       int cl = fpclass(x);
+
+       return ((cl == FP_NINF) || (cl == FP_PINF));
+#else
+       (void)x;
+       return 0;               /* XXX not correct if infinite */
+#endif
+}
+# endif
+#endif /* HAVE_FPCLASSIFY */
+
 extern double sqrt(double x);
 extern double sin(double x);
 extern double cos(double x);
diff --git a/tools/embedded/Makefile.ag b/tools/embedded/Makefile.ag
--- a/tools/embedded/Makefile.ag
+++ b/tools/embedded/Makefile.ag
@@ -18,9 +18,10 @@
 MTSAFE
 
 INCLUDES = ../../monetdb5/mal \
-                  ../../monetdb5/modules/atoms \ 
-                  ../../monetdb5/modules/mal \ 
-                  ../../monetdb5/extras/rapi \ 
+                  ../../monetdb5/modules/atoms \
+                  ../../monetdb5/modules/mal \
+                  ../../monetdb5/modules/kernel \
+                  ../../monetdb5/extras/rapi \
                   ../../gdk \
                   ../../common/stream \
                   ../../common/utils \
@@ -31,7 +32,7 @@ INCLUDES = ../../monetdb5/mal \
                   ../../sql/common \
                   ../../sql/storage \
                   ../../sql/storage/bat \
-                  ../../sql/backends/monet5 \ 
+                  ../../sql/backends/monet5 \
                   $(pcre_CFLAGS)
 
 lib_embedded  = {
diff --git a/tools/embedded/embeddedr.c b/tools/embedded/embeddedr.c
--- a/tools/embedded/embeddedr.c
+++ b/tools/embedded/embeddedr.c
@@ -5,6 +5,7 @@
 #include "R_ext/Random.h"
 #include "monet_options.h"
 #include "mal.h"
+#include "mmath.h"
 #include "mal_client.h"
 #include "mal_linker.h"
 #include "msabaoth.h"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to