title: BigInteger power of a BigDecimal in Java
body: <p>I tried to get the power of a <code>double</code> value where the exponent is very large (Java <code>BigInteger</code> can contain it (the exponent), for example: 10^30)</p>
  
  <p>That is, I want to find something like <strong>1.75^(10^30)</strong> or <strong>1.23^(34234534534222)</strong>.if the output is too large modify it by getting the modulus by a prime like 10^9+7.</p>
  
  <p>If I want to find a power of an <code>Integer</code> I can use <strong><code>BigInteger.modPow()</code></strong> method which take <code>BigInteger</code> arguments:</p>
  
  <pre><code>( BigInteger modPow(BigInteger exponent, BigInteger m) )
  </code></pre>
  
  <p>As far as i can go this is what i got in Java</p>
  
  <pre><code>new BigDecimal("1.5").pow(1000); // .pow() can get only integers as a parameter , but i want to pass a big number like a BigInteger 
  </code></pre>
  
  <p>I cannot find an equivalent for that (<strong>BigInteger.modPow()</strong>) in java for  <strong><code>BigDecimal</code></strong> 
  , or i'm missing that.</p>
  
  <p>Are there any ways to do that - Calculate a large power of a floating point number (a <code>Decimal</code>)?</p>
  
  <p><strong>Example of input and output :</strong></p>
  
  <p>Input    :  num   // or 1.5 or any decimal number. can be an integer also.</p>
  
  <p>exponent : exp   // big integer or a Long value</p>
  
  <p>output  : num^exp  // <strong>num to ther power exp</strong></p>
  
  <p>i.e like calculating <strong>1.23^(34234534534222)</strong></p>
  
  <p>if the output is too large modify it by getting the modulus by a prime like 10^9+7</p>