title: Is there any easy way to round a float with one digit number in objective c?
body: <p>Yes. You are right. Of Course this is a duplicate question. Before flag my question, please continue reading below.</p>
  
  <p>I want to round a float value, which is </p>
  
  <pre><code>56.6748939 to 56.7
  56.45678 to 56.5
  56.234589 to 56.2
  </code></pre>
  
  <p><strong>Actually it can be any number of decimal precisions. But I want to round it to nearest value. (If it is greater than or equal to 5, then round up and if not, then round down).</strong></p>
  
  <p>I can do that with the below code.</p>
  
  <pre><code>float value = 56.68899
  NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc]init];
  [numberFormatter setMaximumFractionDigits:1];
  [numberFormatter setRoundingMode:NSNumberFormatterRoundUp];
  
  NSString *roundedString = [numberFormatter stringFromNumber:[NSNumber numberWithFloat:value]];
  NSNumber *roundedNumber = [NSNumber numberFromString:roundedString];
  float roundedValue = [roundedNumber floatValue];
  </code></pre>
  
  <p>Above code looks like a long process. I have several numbers to round off. <strong>So this process is hard to convert a float value into NSNumber and to NSString and to NSNumber and to float.</strong> </p>
  
  <p>Is there any other easy way to achieve what I asked ? </p>
  
  <p>I still have a doubt in the above code. It says <code>roundUp</code>. So when it comes to <code>roundDown</code>, will it work?</p>