F#: integer (%) integer - Is Calculated How?
<p>So in my text book there is this example of a recursive function using f#</p>

<pre><code>let rec gcd = function
| (0,n) -&gt; n
| (m,n) -&gt; gcd(n % m,m);;
</code></pre>

<p>with this function my text book gives the example by executing:</p>

<pre><code>gcd(36,116);;
</code></pre>

<p>and since the m = 36 and not 0 then it ofcourse goes for the second clause like this:</p>

<pre><code>gcd(116 % 36,36)
gcd(8,36)
gcd(36 % 8,8)
gcd(4,8)
gcd(8 % 4,4)
gcd(0,4) 
and now hits the first clause stating this entire thing is = 4.
</code></pre>

<p>What i don't get is this (%)percentage sign/operator or whatever it is called in this connection. for an instance i don't get how</p>

<pre><code>116 % 36 = 8
</code></pre>

<p>I have turned this so many times in my head now and I can't figure how this can turn into 8? </p>

<p>I know this is probably a silly question for those of you who knows this but I would very much appreciate your help the same. </p>