title: Formatting double for showing only 4 digits
body: <p>Is there a way to format a double number that always have <code>n</code> digits sepecified by user?</p>
  
  <p>For example if user want to see always 4 digits, take the following numbers as example:</p>
  
  <pre><code>Original             Formatted
  -------             ---------
  3.42421             3.424
  265.6250            265.6
  812.50              812.5
  12.68798            12.68
  0.68787             0.687
  </code></pre>
  
  <p>I made up this but it just allows for number of floating points! it is not what I wanted!</p>
  
  <pre><code>    public string ToEngV(double d, int percision = 0)
      {
          string zeros = string.Empty;
  
          if (percision &lt;= 0)
          {
                  zeros += "0";
          }
          else if (percision &gt; 0)
          {
              for (int i = 0; i &lt; percision; i++)
              {
                  zeros += "0";
              }
          }
  
         return String.Format("{0:0." + zeros + "}", d) 
       }
  </code></pre>
  
  <p>Imagine I call the above method for a number like <code>812.50</code> and I set the precision to  (this is now used for all numbers I am going to format). Obviously the output will be <code>812.5</code> </p>
  
  <p>But if I give the another number like <code>1.61826</code> I will get <code>1.6</code> and this ruins the formatting in the page I show these number to users. I need that to be <code>1.618</code></p>
  
  <p>Thus I want my method to always show <code>N</code> digit! </p>