目标:使用小数取代整数 反模式:使用Float类型 根据IEEE754标识,float类型使用二进制格式编码实数数据. 缺点:(1)舍入的必要性: 并不是所有的十进制中描述的信息都能使用二进制存储,处于一些必要的因素, 浮点数通常是舍入到了一个非常接近的值. 举例:select rate from A where id=123 --Result:59.95 select * from A where ra
--1.取整(大) select ceil(-1.001) value from dual ; --2.取整(小) select floor(-1.001) value from dual ; --3.取整(截取) select trunc(-1.002) value from dual ; --4.取整(舍入) select round(-1.001) value from dual; 待人以诚,做事用心,对事不对人.
function f1(type,num1) { switch(type) { case 'floor': return Math.floor(num1);//取整或下舍入 break; case 'round': return Math.round(num1);//四舍五入 break; case 'ceil': return Math.ceil(num1);//上舍入 break; case 'abs': return Math.abs(num1);//取绝对值 break; } } fun