title: How to avoid integer overflow in case of pow function in division with a number?
body: <p>I have the following statement.  </p>
  
  <pre><code>d = (pow(a,2*l+1)+1)/(val+1);  
  </code></pre>
  
  <p>Here, </p>
  
  <ul>
  <li><code>val</code>, <code>a</code> and <code>l</code> are variables which are of no relation to the question.  </li>
  <li>the numerator can exceed long long int range.  </li>
  <li>denominator is a divisor of the numerator.</li>
  </ul>
  
  <p>But the final answer <strong>d</strong> will surely be under the <code>long long</code> int range. How to calculate <code>d</code> without loss of accuracy? I would prefer an answer without converting them to array and using grade school multiplication and division.  </p>