The code is here: https://pastebin.com/gKnVmPFf
I've checked that it's not because of neighboring cells, because I am translating them onto a different array. I can't seem to figure out want is wrong. It's not overflow, nor is it floating types. It might be because of some computer bug with floating types, but I don't see why that would cause any problems.