You are dividing by "zero". STOP DOING THAT. might be due to automatic memory allocation by the stl lib.