Changeset: 54307bb7d1ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54307bb7d1ae
Modified Files:
NT/monetdb_config.h.in
configure.ag
monetdb5/modules/kernel/batmmath.c
monetdb5/modules/kernel/mmath.c
monetdb5/modules/kernel/mmath.mal
Branch: default
Log Message:
No cbrt function in Visual Studio 2010.
diffs (111 lines):
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -100,6 +100,11 @@
MSVC and with C++ compilers. */
#define FLEXIBLE_ARRAY_MEMBER
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+/* Define to 1 if you have the `cbrt' function. */
+#define HAVE_CBRT 1
+#endif
+
/* If the console should be used */
#define HAVE_CONSOLE 1
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2560,6 +2560,7 @@ LIBS="$LIBS $MATH_LIBS"
AC_CHECK_FUNCS([\
asctime_r \
backtrace \
+ cbrt \
ctime_r \
fabsf \
fallocate \
diff --git a/monetdb5/modules/kernel/batmmath.c
b/monetdb5/modules/kernel/batmmath.c
--- a/monetdb5/modules/kernel/batmmath.c
+++ b/monetdb5/modules/kernel/batmmath.c
@@ -168,6 +168,16 @@ str CMDscience_cst_bat_##FUNC##_##TYPE(b
scienceFcnImpl(Operator,dbl,) \
scienceFcnImpl(Operator,flt,f)
+#define scienceNotImpl(FUNC)
\
+str CMDscience_bat_flt_##FUNC(bat *ret, const bat *bid) \
+{
\
+ throw(MAL, "batmmath." #FUNC, PROGRAM_NYI); \
+}
\
+str CMDscience_bat_dbl_##FUNC(bat *ret, const bat *bid) \
+{
\
+ throw(MAL, "batmmath." #FUNC, PROGRAM_NYI); \
+}
+
scienceImpl(asin)
scienceImpl(acos)
scienceImpl(atan)
@@ -183,7 +193,11 @@ scienceImpl(exp)
scienceImpl(log)
scienceImpl(log10)
scienceImpl(sqrt)
+#ifdef HAVE_CBRT
scienceImpl(cbrt)
+#else
+scienceNotImpl(cbrt)
+#endif
scienceImpl(ceil)
scienceImpl(fabs)
scienceImpl(floor)
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
@@ -76,6 +76,18 @@ MATHbinary##NAME##TYPE(TYPE *res, const
return MAL_SUCCEED;
\
}
+#define unopM5NOT(NAME, FUNC) \
+str
\
+MATHunary##NAME##dbl(dbl *res , const dbl *a) \
+{
\
+ throw(MAL, "mmath." #FUNC, PROGRAM_NYI); \
+}
\
+str
\
+MATHunary##NAME##flt(flt *res , const flt *a) \
+{
\
+ throw(MAL, "mmath." #FUNC, PROGRAM_NYI); \
+}
+
#define binopM5(NAME, FUNC) \
binopbaseM5(NAME, FUNC, dbl) \
binopbaseM5(NAME, FUNC, flt)
@@ -127,7 +139,11 @@ unopM5(_LOG10,log10)
binopM5(_POW,pow)
unopM5(_SQRT,sqrt)
+#ifdef HAVE_CBRT
unopM5(_CBRT,cbrt)
+#else
+unopM5NOT(_CBRT,cbrt)
+#endif
unopM5(_CEIL,ceil)
unopM5(_FLOOR,floor)
diff --git a/monetdb5/modules/kernel/mmath.mal
b/monetdb5/modules/kernel/mmath.mal
--- a/monetdb5/modules/kernel/mmath.mal
+++ b/monetdb5/modules/kernel/mmath.mal
@@ -133,13 +133,13 @@ command sqrt(y:flt) :flt
address MATHunary_SQRTflt;
command sqrt(y:dbl) :dbl
address MATHunary_SQRTdbl
-comment "The cbrt(x) function returns the non-negative cube root of x.";
+comment "The sqrt(x) function returns the non-negative root of x.";
command cbrt(y:flt) :flt
address MATHunary_CBRTflt;
command cnrt(y:dbl) :dbl
address MATHunary_CBRTdbl
-comment "The cbrt(x) function returns the non-negative cube root of x.";
+comment "The cbrt(x) function returns the cube root of x.";
command ceil(y:flt) :flt
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list