其中ceil为向上取整,round为四舍五入取整,floor为向下取整。
mysql> select ceil(2.44),round(2.44),floor(2.44);
+------------+-------------+-------------+
| ceil(2.44) | round(2.44) | floor(2.44) |
+------------+-------------+-------------+
| 3 | 2 | 2 |
+------------+-------------+-------------+
1 row in set (0.00 sec)
mysql> select ceil(2.55),round(2.55),floor(2.55);
+------------+-------------+-------------+
| ceil(2.55) | round(2.55) | floor(2.55) |
+------------+-------------+-------------+
| 3 | 3 | 2 |
+------------+-------------+-------------+
1 row in set (0.00 sec)
*文章为作者独立观点,不代表上流阁立场
本文由 江风成 授权 上流阁 发表,并经上流阁编辑。转载此文章须经作者同意,并请附上出处(上流阁)及本页链接。原文链接https://www.o6c.com/java/2016/12/26/887.html