Changeset: 28df5e4b072c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/28df5e4b072c Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test monetdb5/modules/kernel/mmath.c sql/common/sql_types.c sql/test/2024/Tests/All Branch: default Log Message:
add support for math nextafter, fixing bug #7101 diffs (80 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -47519,6 +47519,16 @@ command mmath.log2arg(X_0:flt, X_1:flt): MATHbinary_LOGflt; The log(x) function returns the logarithm of x in the given base. mmath +nextafter +command mmath.nextafter(X_0:dbl, X_1:dbl):dbl +MATHbinary_NEXTAFTERdbl; +The returns the next representable floating-point value of x in the direction of y. +mmath +nextafter +command mmath.nextafter(X_0:flt, X_1:flt):flt +MATHbinary_NEXTAFTERflt; +The returns the next representable floating-point value of x in the direction of y. +mmath pi command mmath.pi():dbl MATHpi; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -35989,6 +35989,16 @@ command mmath.log2arg(X_0:flt, X_1:flt): MATHbinary_LOGflt; The log(x) function returns the logarithm of x in the given base. mmath +nextafter +command mmath.nextafter(X_0:dbl, X_1:dbl):dbl +MATHbinary_NEXTAFTERdbl; +The returns the next representable floating-point value of x in the direction of y. +mmath +nextafter +command mmath.nextafter(X_0:flt, X_1:flt):flt +MATHbinary_NEXTAFTERflt; +The returns the next representable floating-point value of x in the direction of y. +mmath pi command mmath.pi():dbl MATHpi; 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 @@ -200,6 +200,8 @@ unopM5(_ACOS, acos) binopM5(_ATAN2, atan2) binopM5(_POW, pow) binopM5(_LOG, logbs) + binopM5(_NEXTAFTER, nextafter) + static str MATHunary_FABSdbl(dbl *res, const dbl *a) { @@ -357,6 +359,8 @@ mel_func mmath_init_funcs[] = { command("mmath", "log2", MATHunary_LOG2dbl, false, "The log2(x) function returns the base-2 logarithm of x.", args(1,2, arg("",dbl),arg("x",dbl))), command("mmath", "pow", MATHbinary_POWflt, false, "", args(1,3, arg("",flt),arg("x",flt),arg("y",flt))), command("mmath", "pow", MATHbinary_POWdbl, false, "The pow(x,y) function returns the value of x raised to the power of y.", args(1,3, arg("",dbl),arg("x",dbl),arg("y",dbl))), + command("mmath", "nextafter", MATHbinary_NEXTAFTERflt, false, "The returns the next representable floating-point value of x in the direction of y.", args(1,3, arg("",flt),arg("x",flt),arg("y",flt))), + command("mmath", "nextafter", MATHbinary_NEXTAFTERdbl, false, "The returns the next representable floating-point value of x in the direction of y.", args(1,3, arg("",dbl),arg("x",dbl),arg("y",dbl))), command("mmath", "sqrt", MATHunary_SQRTflt, false, "", args(1,2, arg("",flt),arg("y",flt))), command("mmath", "sqrt", MATHunary_SQRTdbl, false, "The sqrt(x) function returns the non-negative root of x.", args(1,2, arg("",dbl),arg("y",dbl))), command("mmath", "cbrt", MATHunary_CBRTflt, false, "", args(1,2, arg("",flt),arg("y",flt))), diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1440,6 +1440,7 @@ sqltypeinit( allocator *sa) } for (t = floats; t < dates; t++) { + sql_create_func(sa, "nextafter", "mmath", "nextafter", FALSE, FALSE, SCALE_FIX, 0, *t, 2, *t, *t); sql_create_func(sa, "power", "mmath", "pow", FALSE, FALSE, SCALE_FIX, 0, *t, 2, *t, *t); sql_create_func(sa, "floor", "mmath", "floor", FALSE, FALSE, SCALE_FIX, 0, *t, 1, *t); sql_create_func(sa, "ceil", "mmath", "ceil", FALSE, FALSE, SCALE_FIX, 0, *t, 1, *t); diff --git a/sql/test/2024/Tests/All b/sql/test/2024/Tests/All --- a/sql/test/2024/Tests/All +++ b/sql/test/2024/Tests/All @@ -1,3 +1,4 @@ groupby_primary_key_project_unique_key distinct_from check +nextafter _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org