title: Controlling number of decimal digits in print output in R
body: <p>There is an option in R to get control over digit display. For example:</p>
  
  <pre><code>options(digits=10)
  </code></pre>
  
  <p>is supposed to give the calculation results in 10 digits till the end of R session. In the help file of R, the definition for digits parameter is as follows:</p>
  
  <blockquote>
    <p>digits: controls the number of digits
    to print when printing numeric values.
    It is a suggestion only. Valid values
    are <strong>1...22</strong> with default <strong>7</strong></p>
  </blockquote>
  
  <p>So, it says this is a suggestion only. What if I like to always display 10 digits, not more or less?</p>
  
  <p>My second question is, what if I like to display more than 22 digits, i.e. for more precise calculations like 100 digits? Is it possible with base R, or do I need an additional package/function for that?</p>
  
  <p><strong>Edit:</strong> Thanks to jmoy's suggestion, I tried <code>sprintf("%.100f",pi)</code> and it gave</p>
  
  <pre><code>[1] "3.1415926535897931159979634685441851615905761718750000000000000000000000000000000000000000000000000000"
  </code></pre>
  
  <p>which has 48 decimals. Is this the maximum limit R can handle?</p>