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 函数的更多相关文章

  1. Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明

    Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明 FLOOR——对给定的数字取整数位SQL> select floor(2345.67) from dua ...

  2. 问题:oracle floor;结果:Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明

    Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明 (2011-04-06 16:10:35) 转载▼ 标签: 谈 分类: 渐行渐远 FLOOR——对给定的数字取 ...

  3. java只能的round,ceil,floor方法的使用

    三者均位于java.lange包下的Math类中 round: 在原来数字的基础上加上0.5后向下取整, 例如: Math.floor(11.5)=12; Math.floor(-11.5)=-11( ...

  4. JavaScript中Math--random()/floor()/round()/ceil()

    Math.random():返回0-1之间的任意数,不包括0和1: Math.floor(num):返回小于等于num的整数,相当于四舍五入的四舍,不五入:例子:Math.floor(1.0);Mat ...

  5. 【java.math.BigInteger】常用函数

    1. /* 返回此BigInteger的函数正负号. 此方法返回-1,0或1作为此BigInteger的值对应是负,零或正数. */ java.math.BigInteger.signum(BigIn ...

  6. floor() 和 ceil()函数

    在C语言的库函数中,floor函数的语法例如以下: #include <math.h> double floor( double arg ); 功能: 函数返回參数不大于arg的最大整数. ...

  7. Java Math的floor,round,ceil函数小结

    转自 http://blog.csdn.net/foart/article/details/4295645 floor 返回不大于的最大整数 round 则是4舍5入的计算,入的时候是到大于它的整数( ...

  8. JAVA除法保留小数点后两位的两种方法 Java Math的 floor,round和ceil的总结

    floor 返回不大于的最大整数 round 则是4舍5入的计算,入的时候是到大于它的整数round方法,它表示“四舍五入”,算法为Math.floor(x+0.5),即将原来的数字加上0.5后再向下 ...

  9. callable函数 stride的意义 Math.round(),Math.ceil(),Math.floor()用法

    callable()函数检查一个函数是否可以调用 如果返回True,object仍然可能调用失败:但如果返回False,调用对象ojbect绝对不会成功. 对于函数, 方法, lambda 函式, 类 ...

随机推荐

  1. SQL触发器中若取到null值可能引发的问题

    declare @code varchar(20), @cs varchar(20),@zc varchar(20)set @cs='('+@cs+'*'+@zc+')'print '字符'+@csi ...

  2. 【故障处理】mysql出现大量slave bin日志,将磁盘空间占满

    master服务器IO线程 NO  问题描述:造成大量slave bin 日志 大量占用磁盘 排查解决步骤: 1.检查是配置的问题还是mysql数据库本身的故障 2.将master的机器 mysql_ ...

  3. codeforces 515C. Drazil and Factorial 解题报告

    题目链接:http://codeforces.com/problemset/problem/515/C 题目意思:给出含有 n 个只有阿拉伯数字的字符串a(可能会有前导0),设定函数F(a) = 每个 ...

  4. PUTTY的使用教程

    Putty是一个优秀的,开源的SSH远程登录软件. 它不仅仅可以实现登录,还有很多高级功能. PuTTY is a free SSH, Telnet and Rlogin client for 32- ...

  5. 【leetcode】Validate Binary Search Tree(middle)

    Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as ...

  6. Java抽象类接口、内部类题库

    一.    选择题 1. Person类和Test类的代码如下所示,则代码中的错误语句是(  C  ).(选择一项)   public class Person { public String nam ...

  7. 35. Search Insert Position

    题目: Given a sorted array and a target value, return the index if the target is found. If not, return ...

  8. Stanford大学机器学习公开课(四):牛顿法、指数分布族、广义线性模型

    (一)牛顿法解最大似然估计 牛顿方法(Newton's Method)与梯度下降(Gradient Descent)方法的功能一样,都是对解空间进行搜索的方法.其基本思想如下: 对于一个函数f(x), ...

  9. 数据存储--sqlite总结

    SQLite SQLite(轻量级的数据库,关系型数据库) 辅助工具:Navicat Premium 等 原理:ios针对存储问题封装了sqlite数据库(c语言数据库). 1 app获取沙盒地址命名 ...

  10. Spring学习笔记—Spring之旅

    1.Spring简介     Spring是一个开源框架,最早由Rod Johnson创建,并在<Expert One-on-One:J2EE Design and Development> ...