title: C++ vs Python precision
body: <p>Trying out a problem of finding the first k digits of a num^num I wrote the same program in C++ and Python </p>
  
  <p>C++</p>
  
  <pre><code>long double intpart,num,f_digit,k;
  cin&gt;&gt;num&gt;&gt;k;
  f_digit= pow(10.0,modf(num*log10(num),&amp;intpart)+k-1);
  cout&lt;&lt;f_digit;
  </code></pre>
  
  <p>Python</p>
  
  <pre><code>(a,b) = modf(num*log10(num))
  f_digits = pow(10,b+k-1)
  print f_digits
  </code></pre>
  
  <p>Input </p>
  
  <pre><code>19423474 9
  </code></pre>
  
  <p>Output </p>
  
  <pre><code>C++    &gt; 163074912
  Python &gt; 163074908
  </code></pre>
  
  <p>I checked the results the C++ solution is the accurate one.
  Checked it at http://www.wolframalpha.com/input/?i=19423474^19423474</p>
  
  <p>Any idea how can I get the same precision in Python  ???</p>
  
  <p>EDIT : I know about the external library packages to obtain this precision but any NATIVE solution ???</p>