Java Math floor round ceil 函数
public final class Math extends Object
public static double floor(double a)
public static long round(double a)
public static int round(float a)
public static double ceil(double a)
floor 返回不大于的最大整数;
ceil 则是不小于他的最小整数;
round 它表示“四舍五入”,算法为Math.floor(x+0.5),即将原来的数字加上0.5后再向下取整;
所以,Math.round(11.5)的结果为12,Math.round(-11.5)的结果为-11;
| Math.floor | Math.round | Math.ceil | |
|
1.4
|
1.0
|
1
|
2.0
|
|
1.5
|
1.0
|
2
|
2.0
|
|
1.6
|
1.0
|
2
|
2.0
|
|
-1.4
|
-2.0
|
-1
|
-1.0
|
|
-1.5
|
-2.0
|
-1
|
-1.0
|
|
-1.6
|
-2.0
|
-2
|
-1.0
|
Java Math floor round ceil 函数的更多相关文章
- Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明
Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明 FLOOR——对给定的数字取整数位SQL> select floor(2345.67) from dua ...
- 问题:oracle floor;结果:Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明
Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明 (2011-04-06 16:10:35) 转载▼ 标签: 谈 分类: 渐行渐远 FLOOR——对给定的数字取 ...
- java只能的round,ceil,floor方法的使用
三者均位于java.lange包下的Math类中 round: 在原来数字的基础上加上0.5后向下取整, 例如: Math.floor(11.5)=12; Math.floor(-11.5)=-11( ...
- JavaScript中Math--random()/floor()/round()/ceil()
Math.random():返回0-1之间的任意数,不包括0和1: Math.floor(num):返回小于等于num的整数,相当于四舍五入的四舍,不五入:例子:Math.floor(1.0);Mat ...
- 【java.math.BigInteger】常用函数
1. /* 返回此BigInteger的函数正负号. 此方法返回-1,0或1作为此BigInteger的值对应是负,零或正数. */ java.math.BigInteger.signum(BigIn ...
- floor() 和 ceil()函数
在C语言的库函数中,floor函数的语法例如以下: #include <math.h> double floor( double arg ); 功能: 函数返回參数不大于arg的最大整数. ...
- Java Math的floor,round,ceil函数小结
转自 http://blog.csdn.net/foart/article/details/4295645 floor 返回不大于的最大整数 round 则是4舍5入的计算,入的时候是到大于它的整数( ...
- JAVA除法保留小数点后两位的两种方法 Java Math的 floor,round和ceil的总结
floor 返回不大于的最大整数 round 则是4舍5入的计算,入的时候是到大于它的整数round方法,它表示“四舍五入”,算法为Math.floor(x+0.5),即将原来的数字加上0.5后再向下 ...
- callable函数 stride的意义 Math.round(),Math.ceil(),Math.floor()用法
callable()函数检查一个函数是否可以调用 如果返回True,object仍然可能调用失败:但如果返回False,调用对象ojbect绝对不会成功. 对于函数, 方法, lambda 函式, 类 ...
随机推荐
- [转载]Linux命令笔记
*以下内容均来自于网络转载,感谢原作者分享 <对Linux新手非常有用的20个命令> 传送门 英文原文为“Switching From Windows to Nix or a Newbie ...
- bing壁纸xml地址
http://www.bing.com/gallery/?src=livesino# http://www.bing.com/HPImageArchive.aspx?format=xml&id ...
- winrt反射
第一步引用扩展类. using System.Reflection.IntrospectionExtensions; 第二步反射. gridView是我定义的GridView控件.ItemClick是 ...
- Common Knowledge_快速幂
问题 I: Common Knowledge 时间限制: 1 Sec 内存限制: 64 MB提交: 9 解决: 8[提交][状态][讨论版] 题目描述 Alice and Bob play som ...
- PUTTY的使用教程
Putty是一个优秀的,开源的SSH远程登录软件. 它不仅仅可以实现登录,还有很多高级功能. PuTTY is a free SSH, Telnet and Rlogin client for 32- ...
- Android 6.0的运行时权限
原文 http://droidyue.com/blog/2016/01/17/understanding-marshmallow-runtime-permission/ 主题 安卓开发 Andr ...
- myeclipse破解
由于内容比较多,我就直接转载了 ,同时感谢原博主 http://blog.itpub.net/27042095/viewspace-1164998/
- python基础——map/reduce
python基础——map/reduce Python内建了map()和reduce()函数. 如果你读过Google的那篇大名鼎鼎的论文“MapReduce: Simplified Data Pro ...
- hdu1212(大数取模)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1212 题意:给出两个数a, b,求a%b: 思路:(c+d)%e=c%e+d%e,(c*d)%e=(c ...
- Xcode常用代码块
Xcode的代码片段(Code Snippets)创建自定义的代码片段,当你重用这些代码片段时,会给你带来很大的方便. 常用的: 1.strong:@property (nonatomic,stron ...