Changeset: fab785e2912b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fab785e2912b
Modified Files:
gdk/gdk_calc.c
sql/backends/monet5/sql_cast.c
sql/backends/monet5/sql_fround.c
Branch: Dec2016
Log Message:
Not all systems support the function round().
diffs (45 lines):
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -13455,7 +13455,6 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
#define rounddbl(x) round(x)
#endif
-/* Windows doesn't have round or trunc, but it does have floor and ceil */
#ifndef HAVE_ROUND
static inline double
round(double val)
diff --git a/sql/backends/monet5/sql_cast.c b/sql/backends/monet5/sql_cast.c
--- a/sql/backends/monet5/sql_cast.c
+++ b/sql/backends/monet5/sql_cast.c
@@ -466,6 +466,19 @@ SQLbatstr_cast(Client cntxt, MalBlkPtr m
return msg;
}
+#ifndef HAVE_ROUND
+static inline double
+round(double val)
+{
+ /* round to nearest integer, away from zero */
+ if (val < 0)
+ return -floor(-val + 0.5);
+ else
+ return floor(val + 0.5);
+}
+#define roundf(x) ((float)round((double)(x)))
+#endif
+
/* up casting */
#define TP1 bte
diff --git a/sql/backends/monet5/sql_fround.c b/sql/backends/monet5/sql_fround.c
--- a/sql/backends/monet5/sql_fround.c
+++ b/sql/backends/monet5/sql_fround.c
@@ -23,7 +23,6 @@
#include "clients.h"
#include "mal_instruction.h"
-/* Windows doesn't have round or trunc, but it does have floor and ceil */
#ifndef HAVE_ROUND
static inline double
round(double val)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list