Sunday, January 6, 2013

Agh

AGH.

-1 % 2 != 1

WHY DIDN'T I ALREADY KNOW THIS

2 comments:

  1. Interestingly, in Perl and Python it IS 1. C and C++ seem to agree with your finding though. I'm guessing your discovery is in C#, yes?

    ReplyDelete
  2. That would be correct. Basically, using x % 2 == 1 is a poor check of oddness. I had some terrain mip chain code that was incorrect on negative regions. x % 2 != 0 works fine.

    ReplyDelete