Changeset: 3e1898b977a2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3e1898b977a2 Modified Files: monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/mmath.c Branch: Oct2014 Log Message:
Communicate the error that was produced in a math function.
diffs (119 lines):
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
@@ -78,8 +78,10 @@ str CMDscience_bat_##TYPE##_##FUNC(bat *
if (errno != 0 ||
\
fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
FE_OVERFLOW | FE_UNDERFLOW) != 0) {
\
+ int e = errno;
\
BBPreleaseref(bn->batCacheid);
\
- throw(MAL, "batmmath." #FUNC, "Math exception");
\
+ throw(MAL, "batmmath." #FUNC, "Math exception: %s",
\
+ strerror(e));
\
}
\
BATsetcount(bn, BATcount(b));
\
bn->tsorted = 0;
\
@@ -127,8 +129,10 @@ str CMDscience_bat_cst_##FUNC##_##TYPE(b
if (errno != 0 ||
\
fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
FE_OVERFLOW | FE_UNDERFLOW) != 0) {
\
+ int e = errno;
\
BBPreleaseref(bn->batCacheid);
\
- throw(MAL, "batmmath." #FUNC, "Math exception");
\
+ throw(MAL, "batmmath." #FUNC, "Math exception: %s",
\
+ strerror(e));
\
}
\
BATsetcount(bn, BATcount(b));
\
bn->tsorted = 0;
\
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
@@ -131,46 +131,48 @@ math_unary_FINITE(bit *res, const dbl *a
return MAL_SUCCEED;
}
-#define unopM5(NAME, FUNC)
\
-str
\
-MATHunary##NAME##dbl(dbl *res , const dbl *a) \
-{
\
- double tmp1,tmp2;
\
- str msg= MAL_SUCCEED;
\
- if (*a == dbl_nil) {
\
- *res =dbl_nil;
\
- } else {
\
- tmp1= *a;
\
- errno = 0;
\
- feclearexcept(FE_ALL_EXCEPT);
\
- tmp2 = FUNC(tmp1);
\
- if (errno != 0 ||
\
- fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
- FE_OVERFLOW | FE_UNDERFLOW) !=
0) \
- throw(MAL, "mmath." #FUNC, "Math exception"); \
- *res = (dbl) tmp2;
\
- }
\
- return msg;
\
-}
\
-str
\
-MATHunary##NAME##flt(flt *res , const flt *a) \
-{
\
- double tmp1,tmp2;
\
- str msg= MAL_SUCCEED;
\
- if (*a == flt_nil) {
\
- *res =flt_nil;
\
- } else {
\
- tmp1= *a;
\
- errno = 0;
\
- feclearexcept(FE_ALL_EXCEPT);
\
- tmp2 = FUNC(tmp1);
\
- if (errno != 0 ||
\
- fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
- FE_OVERFLOW | FE_UNDERFLOW) !=
0) \
- throw(MAL, "mmath." #FUNC, "Math exception"); \
- *res = (flt) tmp2;
\
- }
\
- return msg;
\
+#define unopM5(NAME, FUNC)
\
+str
\
+MATHunary##NAME##dbl(dbl *res , const dbl *a)
\
+{
\
+ double tmp1,tmp2;
\
+ str msg= MAL_SUCCEED;
\
+ if (*a == dbl_nil) {
\
+ *res =dbl_nil;
\
+ } else {
\
+ tmp1= *a;
\
+ errno = 0;
\
+ feclearexcept(FE_ALL_EXCEPT);
\
+ tmp2 = FUNC(tmp1);
\
+ if (errno != 0 ||
\
+ fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
+ FE_OVERFLOW | FE_UNDERFLOW) !=
0) \
+ throw(MAL, "mmath." #FUNC, "Math exception: %s",
\
+ strerror(errno));
\
+ *res = (dbl) tmp2;
\
+ }
\
+ return msg;
\
+}
\
+str
\
+MATHunary##NAME##flt(flt *res , const flt *a)
\
+{
\
+ double tmp1,tmp2;
\
+ str msg= MAL_SUCCEED;
\
+ if (*a == flt_nil) {
\
+ *res =flt_nil;
\
+ } else {
\
+ tmp1= *a;
\
+ errno = 0;
\
+ feclearexcept(FE_ALL_EXCEPT);
\
+ tmp2 = FUNC(tmp1);
\
+ if (errno != 0 ||
\
+ fetestexcept(FE_INVALID | FE_DIVBYZERO |
\
+ FE_OVERFLOW | FE_UNDERFLOW) !=
0) \
+ throw(MAL, "mmath." #FUNC, "Math exception: %s",
\
+ strerror(errno));
\
+ *res = (flt) tmp2;
\
+ }
\
+ return msg;
\
}
#define binopbaseM5(NAME,X2,X3)
\
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list
