Objective-C round double to nearest 50
// Nearest 50 is another useful example, 1150 result. Also needs floor().
double pos = 1157.483277;
int nf = 50.0 * floor((pos/50.0)+0.5);
Written by Matthew Teece
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#