title: Format specifications for real numbers
body: <p>I would like to print some real numbers to a log file.  To make them easy to read I would like them to all have the same width.  I know these numbers will range from 0 to 4095.75 so I tried this:</p>
  
  <pre><code>$display("expected= %4.2f, actual= %4.2f", expected, actual)
  </code></pre>
  
  <p>What I expected to see was this:</p>
  
  <pre><code>expected=   12.25, actual=   12.75 
  expected= 4093.25, actual= 4094.75 
  </code></pre>
  
  <p>But what I got in was this:</p>
  
  <pre><code>expected= 12.25, actual= 12.75 
  expected= 4093.25, actual= 4094.75 
  </code></pre>
  
  <p>How do I force the width of the value above the decimal point to be 4 characters?  Section <strong>21.2.1.3 Size of displayed data</strong> of the LRM is silent on %f.</p>