[英]How to round up to nearst decimals? E.g. 23.33 to final output to 23.5 and 23.55 to final output to 24
How to round up to nearst decimals?如何四舍五入到最接近的小数? Eg 23.33 to final output to 23.5 and 23.55 to final output to 24例如 23.33 到最终 output 到 23.5 和 23.55 到最终 output 到 24
Use ceil()
function to "round up to closest 0.5".使用ceil()
function 来“四舍五入到最接近的 0.5”。
ceil(col * 2) / 2
The above will return -1 for -1.3.上面将返回 -1 为 -1.3。 If you instead want -1.5, do如果您想要-1.5,请执行
sign(col) * CEIL(ABS(col) * 2) / 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.