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:
$display("expected= %4.2f, actual= %4.2f", expected, actual)
What I expected to see was this:
expected= 12.25, actual= 12.75
expected= 4093.25, actual= 4094.75
But what I got in was this:
expected= 12.25, actual= 12.75
expected= 4093.25, actual= 4094.75
How do I force the width of the value above the decimal point to be 4 characters? Section 21.2.1.3 Size of displayed data of the LRM is silent on %f.