On 08.01.2017 12:55, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:46 PM, Sven Barth <[email protected]> wrote: >> >>> 2) % is the mod operator in pascal right? So what is the modular assignment >>> %=? num = num mod repeat? >>> >>> p[x] = permutation[x%256]; >>> >>> if (repeat > 0) num %= repeat; >> >> Correct for both. > > > why am I getting this error? Operator is not overloaded: "Double" mod > “LongInt”. Mod can’t be used with double and integers like in C? > > repeatValue: integer; > x, y, z: double; > > if (repeatValue > 0) then > begin > x := x mod repeatValue; > y := y mod repeatValue; > z := z mod repeatValue; > end;
Ehm, right. Add the Math unit, it contains an operator overload for floating points. Alternatively you can use (also from the Math unit) the FMod() function. Regards, Sven _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
