数学班双胞胎(double d) (Math Class double ceil(double d))

  • This method is available in java.lang package.

    此方法在java.lang包中可用。

  • This method is used to return the least or smallest value of the double type value which is greater than or equal to the given parameter.

    此方法用于返回大于或等于给定参数的double类型值的最小值或最小值。

  • This is a static method so it is accessible with the class name too.

    这是一个静态方法,因此也可以使用类名进行访问。

  • The return type of this method is double that means it returns the smallest value of the given parameter [double type].

    此方法的返回类型为double,这意味着它返回给定参数的最小值[double type]。

  • In this method, we pass only one parameter as an argument.

    在此方法中,我们仅传递一个参数作为参数。

  • This method does not throw any exception.

    此方法不会引发任何异常。

Syntax:

句法:

    public static double ceil(double d){
}

Parameter(s):

参数:

double d – A double value whose least or smallest value to be found.

double d-一个双精度值,其最小值或最小值将被找到。

Note:

注意:

  • If we pass "NaN", it returns "NaN".

    如果我们传递“ NaN”,则返回“ NaN”。

  • If we pass zero, it returns the same.

    如果传递零,则返回相同值。

  • If we pass an infinity (positive or negative), it returns the infinity with the same sign.

    如果传递无穷大(正数或负数),它将返回具有相同符号的无穷大。

  • If we pass an argument whose value is less than 0 but greater than -1.0, it returns -0.0.

    如果我们传递的值小于0但大于-1.0的参数,则返回-0.0。

  • If we pass an argument whose value after the decimal point is greater than 0, it returns the incremented value by 1.

    如果我们传递一个参数,该参数的小数点后的值大于0,则返回的值将增加1。

Return value:

返回值:

The return type of this method is double, it returns the least or smallest value of the double type value which is greater than or equal to the given parameter.

此方法的返回类型为double ,它返回大于或等于给定参数的double类型值的最小或最小值。

Java程序演示ceil(double d)方法的示例 (Java program to demonstrate example of ceil(double d) method)

// Java program to demonstrate the example of
// ceil(double d) method of Math Class
class CeilMethod {public static void main(String[] args) {// Here we are declaring few variables
double d1 = -0.0;
double d2 = 0.0;
double d3 = -7.0 / 0.0;
double d4 = 7.0 / 0.0;
double d5 = -0.6;
double d6 = 1000.0;
double d7 = 1000.4;
// Display previous value of d1,d2,d3,d4,d5 ,d6 and d7
System.out.println("Old value of d1 before implementation is: " + d1);
System.out.println("Old value of d2 before implementation is :" + d2);
System.out.println("Old value of d3 before implementation is :" + d3);
System.out.println("Old value of d4 before implementation is :" + d4);
System.out.println("Old value of d5 before implementation is :" + d5);
System.out.println("Old value of d6 before implementation is :" + d6);
System.out.println("Old value of d7 before implementation is :" + d7);
// Here , we will get (-0.0) because we are passing parameter
// (-0.6)  because passed value is less than 0 but greater than -1.0
System.out.println("New value of d1 after implementation is :" + Math.ceil(d1));
// Here , we will get (0.0) because we are passing parameter (0.0)
System.out.println("New value of d2 after implementation is :" + Math.ceil(d2));
// Here , we will get (-Infinity) because we are passing
// parameter (-7.0/0.0)
System.out.println("New value of d3 after implementation is :" + Math.ceil(d3));
// Here , we will get (Infinity) because we are passing
// parameter (7.0/0.0)
System.out.println("New value of d4 after implementation is :" + Math.ceil(d4));
// Here , we will get (-0.0) because we are passing
// parameter (-0.6)  because passed value is less than
// 0 but greater than -1.0
System.out.println("New value of d5 after implementation is :" + Math.ceil(d5));
// Here , we will get (1000.0) because we are passing
// parameter (1000.0)  because passed value after decimal point
// is not greater than 0 so the same number is returned
System.out.println("New value of d6 after implementation is :" + Math.ceil(d6));
// Here , we will get (1001.0) because we are passing
// parameter (1000.4)  because passed value after decimal
// point is greater than 0 so the number is incremented by 1 is returned
System.out.println("New value of d7 after implementation is :" + Math.ceil(d7));
}
}

Output

输出量

E:\Programs>javac CeilMethod.java
E:\Programs>java CeilMethod
Old value of d1 before implementation is :-0.0
Old value of d2 before implementation is :0.0
Old value of d3 before implementation is :-Infinity
Old value of d4 before implementation is :Infinity
Old value of d5 before implementation is :-0.6
Old value of d6 before implementation is :1000.0
Old value of d7 before implementation is :1000.4
New value of d1 after implementation is :-0.0
New value of d2 after implementation is :0.0
New value of d3 after implementation is :-Infinity
New value of d4 after implementation is :Infinity
New value of d5 after implementation is :-0.0
New value of d6 after implementation is :1000.0
New value of d7 after implementation is :1001.0

翻译自: https://www.includehelp.com/java/math-class-static-double-ceil-double-d-with-example.aspx

Java Math类静态double ceil(double d)与示例相关推荐

  1. java math 类_Java Math类静态双层(double d)示例

    java math 类 数学班静态双层(双D) (Math Class static double floor(double d)) This method is available in java. ...

  2. java math.cos_Java Math类静态double cos(double d)示例

    java math.cos 数学类静态双cos(double d) (Math Class static double cos(double d)) This method is available ...

  3. java math 类_Java Math类静态长轮(double d)示例

    java math 类 数学课静态长回合(双D) (Math Class static long round(double d) ) This method is available in java. ...

  4. Java,Math类中的ceil、floor和round函数源码解析以及自己重写实现

    1. ceil.floor和round的功能 首先,这三个方法都是Math类的静态方法,而且类Math在java.lang包下,所以我们在代码中可以直接调用Math的方法. Math.ceil(dou ...

  5. java Math类的常用方法介绍

    java Math类的常用方法介绍 代码块 public class MainTest {public static void main(String[] args) {//求sin值double s ...

  6. java中的starts_Java Math类静态double nextAfter(double starts,double direction)示例

    java中的starts 数学类静态double nextAfter(双向启动,双向) (Math Class static double nextAfter(double starts , doub ...

  7. java math max_Java Math类静态double max(double d1,double d2)示例

    java math max 数学类静态double max(double d1,double d2) (Math Class static double max(double d1,double d2 ...

  8. java中cbrt_Java Math类静态double cbrt(double d)示例

    java中cbrt 数学类静态double cbrt(double d) (Math Class static double cbrt(double d)) This method is availa ...

  9. java hypot_Java Math类静态double hypot(double d1,double d2)与示例

    数学类静态double hypot(double d1,double d2)此方法在java.lang包中可用. 此方法用于返回(square(d1)+ square(d2))的平方根,而无需任何中间 ...

最新文章

  1. DIV布局SEO的影响
  2. 手持发光棒的结构解析
  3. 推荐几款热门的敏捷开发工具
  4. 在windows 2008 R2上安装sharepoint 2013时遇到提示必须安装 .netframeword4.5的处理办法...
  5. redis info查看信息
  6. 皮尔森相关系数Pearson correlation coefficient
  7. 测试工具-Jira和禅道数据库分析
  8. RS485芯片UN485E的特点及其应用
  9. android图标包怎么安装,图标包怎么用 安卓好看的图标包推荐
  10. vue项目项目启动步骤及常见错误处理
  11. SAP 金额转换成大写
  12. ServiceComb 课程
  13. 微信的红包算法 了解一下两种就可以了
  14. C语言实现大计基作业之某种图灵机
  15. 网贷逾期可怕吗?如果通知到朋友会怎么样?
  16. 开源=安全?RVN盗币事件复盘
  17. 2021年7月世界编程语言排行
  18. CDN加速-内容分发网络
  19. cad计算机辅助证书,2020CAD工程师认证证书考试试题(01月27日)
  20. ARP欺骗攻击原理及其防御

热门文章

  1. Windows流氓软件残留文件强制清除基于命令行
  2. 01.大数据介绍以及环境配置
  3. 元神app怎么修改服务器,原神客户端如何修改
  4. 计算机能力培训研修问题,信息技术应用能力提升培训问题汇集.docx
  5. AE基础教程(3)——第3章 合成窗口-缩放,网格,参考线使用
  6. 从玄学到网红,互联网企业取名有何学问?
  7. AI公开课:19.04.24刘聪-科大讯飞AI副院长《人工智能的“顶天立地”之路》课堂笔记以及个人感悟
  8. python图像特征提取进行分割_python实现图片处理和特征提取详解
  9. 在家做什么可以挣钱,6个实用的赚钱方法,赶快收藏吧!
  10. 下载音频到本地 (ximalaya)