Can I control the number of digits displayed in debugger windows for float and double variables?

Although it doesn't appear to be supported in their documentation, we have used the following definition to shorten the numbers (in VS 2015):

  <Type Name="MyVec3d">
    <DisplayString>{vectorX,g}, {vectorY,g}, {vectorZ,g}</DisplayString>
  </Type>

Unfortunately there is really no way to do this fine grained level of a change in C++ debugging. In a managed language it would be possible in some limited scenarios (when the primitives were fields of objects and annotated with special [DebuggerDisplay] attributes). For C++ though this type of customization just doesn't exist.


Primitive types cannot currently be NatVizzed. However, if the specific primitives you're wanting to look at are members of another type that you can watch, you can apply formatting to that type, e.g.

<!-- displays the double value as 0.000 -->
<Type Name="DoubleHolder">
  <DisplayString>{(int)myDouble}.{(int)(myDouble*1000) % 1000}</DisplayString>
</Type>