I need to round a float value and convert it into an NSInteger
value.
For example:
float f = 90.909088;
I want the result to be 91. How to get rid of this?
A quick round and cast will work for negative values as well as positives:
NSInteger intValue = (NSInteger) roundf(f);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With