title: Function Returning Negative Value
body: <p>I still have not run it through enough tests however for some reason, using certain non-negative values, this function will sometimes pass back a negative value.  I have done a lot of manual testing in calculator with different values but I have yet to have it display this same behavior.</p>
  
  <p>I was wondering if someone would take a look at see if I am missing something.</p>
  
  <pre><code>float calcPop(int popRand1, int popRand2, int popRand3, float pERand, float pSRand)
  {
      return ((((((23000 * popRand1) * popRand2) * pERand) * pSRand) * popRand3) / 8);
  }
  </code></pre>
  
  <p>The variables are all contain randomly generated values:</p>
  
  <p>popRand1: between 1 and 30</p>
  
  <p>popRand2: between 10 and 30</p>
  
  <p>popRand3: between 50 and 100</p>
  
  <p>pSRand: between 1 and 1000</p>
  
  <p>pERand: between 1.0f and 5500.0f which is then multiplied by 0.001f before being passed to the function above</p>
  
  <p>Edit:</p>
  
  <p>Alright so after following the execution a bit more closely it is not the fault of this function directly.  It produces an infinitely positive float which then flips negative when I use this code later on:</p>
  
  <p>pPMax = (int)pPStore;</p>
  
  <p>pPStore is a float that holds popCalc's return.</p>
  
  <p>So the question now is, how do I stop the formula from doing this?  Testing even with very high values in Calculator has never displayed this behavior.  Is there something in how the compiler processes the order of operations that is causing this or are my values simply just going too high?</p>