I have a CGFloat which I am trying to round to 1 decimal place. Using the below code, the CGFloat is rounded to 3.700000, according to NSLog:
averageRating = floorf(averageRating * 10.0f + 0.5) / 10.0f;
However, for my code to work, which depends on if statements such as:
if (averageRating == 0.1f)
I need to remove the zeros. I would like the CGFloat to always be to 1 decimal place, as I will always round it to 1 d.p. using the floorf code above.
So again: How can I remove the extra zeros from the CGFloat? All help appreciated.