From 02789b2c423750b80cb849d946f31ed3c441199e Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 13 Jan 2023 13:47:52 +0100 Subject: [PATCH] The modulo function a % n should accept a==0. The fix adds this to the control section function parser. The numparam parser already has this feature. n==0 is rejected as usual. --- src/maths/cmaths/cmath2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/maths/cmaths/cmath2.c b/src/maths/cmaths/cmath2.c index 3e40e370a..888c15a44 100644 --- a/src/maths/cmaths/cmath2.c +++ b/src/maths/cmaths/cmath2.c @@ -676,7 +676,7 @@ void *cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int i; for (i = 0; i < length; i++) { const int r1 = (int) floor(fabs(dd1[i])); - rcheck(r1 > 0, "mod"); + rcheck(r1 >= 0, "mod"); const int r2 = (int)floor(fabs(dd2[i])); rcheck(r2 > 0, "mod"); const int r3 = r1 % r2; @@ -705,11 +705,11 @@ void *cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, c2 = cc2[i]; } const int r1 = (int) floor(fabs(realpart(c1))); - rcheck(r1 > 0, "mod"); + rcheck(r1 >= 0, "mod"); const int r2 = (int) floor(fabs(realpart(c2))); rcheck(r2 > 0, "mod"); const int i1 = (int) floor(fabs(imagpart(c1))); - rcheck(i1 > 0, "mod"); + rcheck(i1 >= 0, "mod"); const int i2 = (int) floor(fabs(imagpart(c2))); rcheck(i2 > 0, "mod"); const int r3 = r1 % r2;