Originally posted by: DaveSimmons
Originally posted by: Zanix
Originally posted by: DaveSimmons
> don't know what the remainder of 30-2 and 40 should be...
You don't understand the "mod" operator? That's not goovy.
You should also look up the precedence rules for your language to see whether you need to be computing
a. (40 % 28 ) /4
It's a. No I didn't understand the mod operator. It's called REM in MIPS and I wasn't sure if it was used the same.
Thanks for the help.
No problem, I was thinking C/C++ rather than assembly, but it should be exactly the same as integer mod operator in C, or rem / mod in other assembly languages.
All return the remainder after division, here (40 % 28) = 12. In really old CPUs like 6502 that lack REM you'd probably code this using a loop subtracting the divisor until the remainder is less than the divisor.
e.g. 40 % 9 :
40 - 9 = 31, - 9 = 22, - 9 = 13, -9 = 4 and stop since 4 < 9.