小數向上取整:ceil()spa
小數向下取整:floor()code
extern float ceilf(float); extern double ceil(double); extern long double ceill(long double); extern float floorf(float); extern double floor(double); extern long double floorl(long double);
小數保留兩位小數:orm
[NSString stringWithFormat:@"%.2f",0.01]; //商品價格