percentage function calculating abnormal value
<p>In the following function I'm receiving abnormal values.</p>

<p>(Please disconsider hungarian notations, I'm following rules of an old source)</p>

<pre><code>int nMaxHP = m_pDefender-&gt;GetMaxHitPoint();
u_long nPercentHP = 0;
if( nMaxHP &gt; 0 )
    nPercentHP = (  nHP * 100 ) / nMaxHP;

CString show;
show.Format( "%u %d %d", nPercentHP, nMaxHP, nHP );
pUserAttacker-&gt;AddTextD3D( show, 0xffff0000 );
</code></pre>

<p>This is part of a damage code on a game client, <code>m_pDefender</code> is the big lion pillar, <code>nHP</code> is the hitpoints he has after taking damage and <code>nMaxHP</code> is self-explanatory.
<code>AddTextD3D( CString format, DWORD color )</code> shows a message as you can see on the image.
<img src="http://i.stack.imgur.com/Vb4nk.jpg" alt="Screenshot"></p>

<p>The thing is,<br>
34.000.000 = nMaxHP<br>
33.999.999 = nHP</p>

<p>33.999.999 * 100 = 3.399.999.900<br>
3.399.999.900 / 34.000.000 = 99 (or 99.99999705882353 on double precision)</p>

<p>The question is why <code>nPercentHP</code> is 4294967270?</p>
