modulus not wrapping properly - unofficial respone

Hi,

For the modulus function, I’m fairly certain that it’s wrapping correctly, based on how the modulus function is normally defined.

This statement is true for the modulus, for two integers A and B.

(A/B) * B +(A%B) = A.

Assuming that’s true, then -1/10 = 0.

And (-1/10) * 10 + (A%B) = A

So (A%B) = -1 because (-1/10) * 10 with integers is 0.

Hope that helps.

I tried the same code compiled in gcc.

#include <stdio.h>

int main( int crgc, char*argv] )
{
	printf("mod 11 is %d\n", 11%10 );
	printf("mod 22 is %d\n", 22%10 );
	printf("mod -1 is %d\n", -1%10 );
}

Same output as ROBOTC.

mod 11 is 1
mod 22 is 2
mod -1 is -1