Changeset: 37793b132126 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=37793b132126
Modified Files:
monetdb5/modules/kernel/mmath.c
Branch: Oct2020
Log Message:
Check for division by 0.
diffs (24 lines):
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
@@ -30,12 +30,20 @@
double
logbs(double base, double x)
{
+ if (base == 1) {
+ feraiseexcept(FE_DIVBYZERO);
+ return INFINITY;
+ }
return log(x) / log(base);
}
float
logbsf(float base, float x)
{
+ if (base == 1) {
+ feraiseexcept(FE_DIVBYZERO);
+ return INFINITY;
+ }
return logf(x) / logf(base);
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list