Odd. You should first find out what line, exactly, is causing the divide by zero. Determining the error is after the method is not precise enough. It should be faulting on a specific line of your code (or, perhaps a method call from SFML or something). Once you find the offending line (and I'm assuming it is a division), you should be able to figure out what is happening.