title: Objective-C: how to round of double to 2 decimal places if there is some value after decimal otherwise the value should be rounded to 0 decimal places
body: <p>How to format a decial value as follows:</p>
  
  <pre><code>/// variable
  double value = 9.99999
  
  /// conversion
  NSSting* str = [NSString stringWithFormat:@"%.2f", value];
  
  /// result
  9.99
  </code></pre>
  
  <p>but when the value is <strong>9.00000</strong> it is returning <strong>9.00</strong></p>
  
  <p>How should I format the string that it would show <code>9.0000 as 9</code> and <code>9.99999 as 9.99</code>??</p>