Fox exa开发者_StackOverflow社区mple: 1.2 should be 1 and 1.6 should be 2
#import <math.h>
float f = 1.2;
float rounded = roundf(f);
Try floor with 0.5 addition:
floor(val + 0.5)
Fox exa开发者_StackOverflow社区mple: 1.2 should be 1 and 1.6 should be 2
#import <math.h>
float f = 1.2;
float rounded = roundf(f);
Try floor with 0.5 addition:
floor(val + 0.5)
精彩评论