In addition to other answers:
float theFloat = 1.23456; int rounded = roundf(theFloat); NSLog(@"%d",rounded); int roundedUp = ceil(theFloat); NSLog(@"%d",roundedUp); int roundedDown = floor(theFloat); NSLog(@"%d",roundedDown);
For rounding to specific decimal places, see the question mentioned by Alex Kazaev.
Anne Apr 08 2018-11-11T00: 00Z
source share