Background
Now as you might or might not know, I enjoy creating Minesweeper puzzles on Puzzling.SE.
I was recently thinking of introducing a complex mines gimmick (where one complex mine is equivalent to $i$ mines, where $i=\sqrt{-1}$), however I wasn't really sure how well it would fare if I decided combine this gimmick and the modular arithmetic gimmick. (I have done only once due to this being just a really hard gimmick to perform here)
As you might know,$$x\pmod n\ge x-n\lfloor x/n\rfloor\quad n\ne0$$However, I wanted to know what would we do in the case of$$(x+yi)\pmod n$$since obviously we could rewrite this as$$x+yi-n\lfloor(x+yi)/n\rfloor\quad n\ne0$$but my question was at this point
Can we simplify this further?
So, I ran two tests on Wolfram Alpha, and here are the results:
| Input | Ouput |
|---|---|
| $\lfloor1+2.5i\rfloor$ | $1+2i$ |
| $\lfloor1.5+2.5i\rfloor$ | $1+2i$ |
So it really just seems that we can rewrite our function for a complex number modulo a real number as$$x+yi-n\lfloor x/n\rfloor-n\lfloor yi/n\rfloor\quad n\ne0$$however I decided to run one more test just to make sure I was right:$$\operatorname{mod}(1.5+2.5i,1)$$which should give us$$x+yi-n\lfloor x/n\rfloor-n\lfloor yi/n\rfloor\quad n\ne0\\\overset{x=1.5,y=2.5,n=1}{\gets}1.5+2.5i-1-2i=0.5+0.5i$$although WA apparently gives us $-0.5+0.5i$, although I feel like that might just be an accidental mess up on WA's part.
My question
Why does any$$\lfloor x+yi\rfloor\gets\lfloor x\rfloor+\lfloor yi\rfloor$$
$1/2$ and $-1/2$ are congruent modulo $1$ since their difference is a multiple of $1$. So either answer might be considered correct. The positive answer is the only correct answer if you insist that the result of the "mod $n$" operator be a number in the range $[0,n)$. That's an assumption software often makes, but need not. Mathematicians don't usually think of mod calculations in operator terms.