Floating Point Exception for seemingly no reason : <p>My code is throwing me a floating point exception here, but I can't figure out why.</p>

<pre><code>int i = this -&gt; numerator;
while(i &gt; 1){
    if ((this -&gt; numerator % i == 0) &amp;&amp; (this -&gt; denominator % i == 0)) {
        this -&gt; numerator = this -&gt; numerator / i;
        this -&gt; denominator = this -&gt; denominator / i;
    }
    i = i - 1;
}
</code></pre>

<p>The goal is to simplify a fraction. As you can see, things only get mod by i and i > 1. Same goes for division. Strangely it will keep throwing the error even if I comment out the code within the while loop, but the code works fine if I get rid of the while loop completely. The same thing happened when I tried to use a for loop instead. What am I missing?</p>
