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.
This commit is contained in:
Holger Vogt 2023-01-13 13:47:52 +01:00
parent 37acfffc6e
commit 61274c50e2
1 changed files with 3 additions and 3 deletions

View File

@ -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;