11-27-2022, 08:03 PM
What do you consider to be correct results?
5 MOD 5 = 0
4 MOD 5 = 4
3 MOD 5 = 3
2 MOD 5 = 2
1 MOD 5 = 1
0 MOD 5 = 0
-1 MOD 5 = 4
-2 MOD 5 = 3
-3 MOD 5 = 2
-4 MOD 5 = 1
-5 MOD 5 = 0
-6 MOD 5 = 4
-7 MOD 5 = 3
^Is that the patten/results you're looking for?
If so, then just do something simple like:
FUNCTION ModAll&& (number as _INTEGER64, number2 AS LONG)
temp&& = number MOD number2
IF temp&& < 0 THEN temp&& = temp&& + number
ModAll = temp&&
END FUNCTION
5 MOD 5 = 0
4 MOD 5 = 4
3 MOD 5 = 3
2 MOD 5 = 2
1 MOD 5 = 1
0 MOD 5 = 0
-1 MOD 5 = 4
-2 MOD 5 = 3
-3 MOD 5 = 2
-4 MOD 5 = 1
-5 MOD 5 = 0
-6 MOD 5 = 4
-7 MOD 5 = 3
^Is that the patten/results you're looking for?
If so, then just do something simple like:
FUNCTION ModAll&& (number as _INTEGER64, number2 AS LONG)
temp&& = number MOD number2
IF temp&& < 0 THEN temp&& = temp&& + number
ModAll = temp&&
END FUNCTION