I\'ve got a float value from an accelerometer which looks like this:
-3.04299553323
I\'d like to get -3.04 for example. Is there an easy way for rounding tha
I know this is old post but just in case someone else is looking for a quick Two step option.
float old = -3.04299553323;
float new = [[NSString stringWithFormat:@"%.2f",old]floatValue];
Result = -3.04
The @"%.2f" will round to two decimal places. If you want three decimal places put @"%.3f" and so on.
Hope this helps!