So I thought that negative numbers, when mod\'ed should be put into positive space... I cant get this to happen in objective-c
I expect this:
-1 % 3
We have a problem of language:
math-er-says: i take this number plus that number mod other-number code-er-hears: I add two numbers and then devide the result by other-number code-er-says: what about negative numbers? math-er-says: WHAT? fields mod other-number don't have a concept of negative numbers? code-er-says: field what? ...
In this case you want the mathematician's mod operator and have the remainder function at your disposal. you can convert the remainder operator into the mathematician's mod operator by checking to see if you fell of the bottom each time you do subtraction.