java Math.round()
来源:互联网 发布:自己动手写网络爬虫pdf 编辑:程序博客网 时间:2024/05/16 17:29
public class MathTest {
}
运行结果:
1、小数点后第一位=5
2、正数:Math.round(11.5)=12
3、负数:Math.round(-11.5)=-11
4、
5、小数点后第一位<5
6、正数:Math.round(11.46)=11
7、负数:Math.round(-11.46)=-11
8、
9、小数点后第一位>5
10、正数:Math.round(11.68)=12
11、负数:Math.round(-11.68)=-12
根据上面例子的运行结果,我们还可以按照如下方式总结,或许更加容易记忆:
1、参数的小数点后第一位<5,运算结果为参数整数部分。
2、参数的小数点后第一位>5,运算结果为参数整数部分绝对值+1,符号(即正负)不变。
3、参数的小数点后第一位=5,正数运算结果为整数部分+1,负数运算结果为整数部分。
终结:大于五全部加,等于五正数加,小于五全不加。
- java Math.round()
- java Math.round()
- java Math.round()
- java Math.round()用法
- java Math.round()
- Java math.round()
- Java:Math.round
- java Math.round()
- java Math.round()
- java.Math.round()
- java Math.round()
- java Math.round()
- java Math.round()
- java Math.round用法
- java Math.round()
- java Math.round()用法
- Java Math.round方法
- JAVA Math floor() round()
- 在Source Insight中看Python代码
- 二叉搜索树(BST)的基本操作
- URI 与 URL
- 在函数中不修改函数传入参数的情况下取到调用程序中的值的方法
- 关于Chrome(谷歌浏览器)对document.documentElement.scrollTop识别
- java Math.round()
- verilog编译问题:SystemVerilog construct not yet implemented: nested module
- vc++中指针学习的两个绝好例子
- 无法启动MSMQ服务
- Hibernate SQL方言 (hibernate.dialect) 汇总
- Delphi COM编程技术二(COM接口和COM组件)
- C#中this的用法
- Delphi COM编程技术一(COM编程基础知识)
- Qt/Qtopia相关网站