title: Formatting number to a specific number of digits in Fortran
body: <p>I am trying to format a number to a certain number of digits (7, actually) like the following:</p>
  <pre><code>215.5745
  6.569674
  16.42418
  </code></pre>
  <p>According to <a href="https://www.l3harrisgeospatial.com/docs/format_codes_fortran.html" rel="nofollow noreferrer">this page</a> (&quot;F, D, E, and G Format Codes&quot;), the possible format code would be:</p>
  <pre><code>[n]F[+][-][w][.d]
  </code></pre>
  <blockquote>
  <p>The variable w specifies the number of digits to be transferred</p>
  </blockquote>
  <p>which appears to be exactly what I am looking for.</p>
  <p>I understand that the d parameter should not be provided as this would cause the number of decimal positions to be fixed, and could be omitted since:</p>
  <blockquote>
  <p>d is an optional width specification</p>
  </blockquote>
  <p>However, gfortran refuses to compile when a format code like &quot;F7&quot; is provided.</p>
  <p><code>Error: Period required in format specifier in format string at (1)</code></p>