title: Natvis Floating-Point Format
body: <p>Yesterday I discovered <a href="https://msdn.microsoft.com/en-us/library/JJ620914.aspx?f=255&amp;MSPPError=-2147217396" rel="noreferrer">MSVC's "Natvis" tool</a>, which allows you to tweak the debugger to present your types in an intelligent way.  I quickly set about prettifying my math library.</p>
  
  <p>Here's how my 3*3 matrix class looks (uninitialized data):</p>
  
  <blockquote>
    <p><a href="https://i.stack.imgur.com/5rYw8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5rYw8.png" alt="matrix 3x3"></a></p>
  </blockquote>
  
  <p>Gorgeous, right?  My afternoon had no regrets.</p>
  
  <p>However, now we get to a slightly more complicated case:</p>
  
  <blockquote>
    <p><a href="https://i.stack.imgur.com/HxDO8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HxDO8.png" alt="matrix 4x4"></a></p>
  </blockquote>
  
  <p>As you can see, the numbers do not align.  I've figured out a <strike> way </strike> <em>nasty crock</em> to get the negative numbers to align with the positive numbers, but my method has no way of approaching this (here's my basic outline):</p>
  
  <pre><code>&lt;Type ...&gt;
      &lt;DisplayString&gt;...&lt;/DisplayString&gt;
      &lt;Expand ...&gt;
          &lt;Synthetic ...&gt;
              &lt;DisplayString ...&gt;...&lt;/DisplayString&gt;
          &lt;/Synthetic&gt;
          ...
      &lt;/Expand&gt;
  &lt;/Type&gt;
  </code></pre>
  
  <p>What's happening is that the number of digits being printed <em>varies</em> from number to number.</p>
  
  <p>Therefore my question: <strong>Can I configure Natvis to print a well-defined number of digits for debugging?  Alternately, perhaps you have a clever workaround?</strong></p>
  
  <hr>
  
  <p><sub><sup>P.S.: I will be happy to upload the Python script that generates the ".natvis" file for y'all to play with for your own types, if I get this working.</sup></sub></p>