日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

strictmath_Java StrictMath ceil()方法与示例

發布時間:2023/12/1 java 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 strictmath_Java StrictMath ceil()方法与示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

strictmath

StrictMath類ceil()方法 (StrictMath Class ceil() method)

  • ceil() method is available in java.lang package.

    ceil()方法在java.lang包中可用。

  • ceil() 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.

    ceil()方法用于返回大于或等于給定參數的double類型值的最小值或最小值。

  • ceil() method is a static method so this method is accessible with the class name too.

    ceil()方法是靜態方法,因此也可以使用類名訪問此方法。

  • ceil() method does not throw any exception at the time of ceiling the given parameter.

    在給定參數設置上限時, ceil()方法不會引發任何異常。

Syntax:

句法:

public static double ceil(double d);

Parameter(s):

參數:

  • double d – represents the double type value whose least value to be found.

    double d –表示要找到其最小值的double類型值。

Return value:

返回值:

The return type of this method is double – it returns least value of the given parameter.

該方法的返回類型為double-返回給定參數的最小值。

Note:

注意:

  • If we pass NaN as an argument, method returns the same value (NaN).

    如果我們將NaN作為參數傳遞,則方法將返回相同的值(NaN)。

  • If we pass zero (0), method returns the same value with the same sign.

    如果傳遞零(0),則方法將返回具有相同符號的相同值。

  • If we pass an infinity, method returns the same value with the same sign.

    如果我們傳遞一個無窮大,則方法將返回帶有相同符號的相同值。

  • If we pass an argument which is less than 0, but greater than -1.0, method returns -0.0.

    如果我們傳遞的參數小于0但大于-1.0,則方法返回-0.0。

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

    如果我們傳遞的參數的小數點后的值大于0,則方法返回的值將增加1。

Example:

例:

// Java program to demonstrate the example // of ceil(double d) method of StrictMath Class.public class Ceil {public static void main(String[] args) {// Variable Declarationdouble 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 d7System.out.println("d1: " + d1);System.out.println("d2: " + d2);System.out.println("d3: " + d3);System.out.println("d4: " + d4);System.out.println("d5: " + d5);System.out.println("d6: " + d6);System.out.println("d7: " + 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.0System.out.println("StrictMath.ceil(d1): " + StrictMath.ceil(d1));// Here , we will get (0.0) because we are passing parameter (0.0)System.out.println("StrictMath.ceil(d2): " + StrictMath.ceil(d2));// Here , we will get (-Infinity) because we are passing parameter (-7.0/0.0) System.out.println("StrictMath.ceil(d3): " + StrictMath.ceil(d3));// Here , we will get (Infinity) because we are passing parameter (7.0/0.0) System.out.println("StrictMath.ceil(d4): " + StrictMath.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.0System.out.println("StrictMath.ceil(d5): " + StrictMath.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 //returnedSystem.out.println("StrictMath.ceil(d6): " + StrictMath.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 returnedSystem.out.println("StrictMath.ceil(d7): " + StrictMath.ceil(d7));} }

Output

輸出量

d1: -0.0 d2: 0.0 d3: -Infinity d4: Infinity d5: -0.6 d6: 1000.0 d7: 1000.4 StrictMath.ceil(d1): -0.0 StrictMath.ceil(d2): 0.0 StrictMath.ceil(d3): -Infinity StrictMath.ceil(d4): Infinity StrictMath.ceil(d5): -0.0 StrictMath.ceil(d6): 1000.0 StrictMath.ceil(d7): 1001.0

翻譯自: https://www.includehelp.com/java/strictmath-ceil-method-with-example.aspx

strictmath

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的strictmath_Java StrictMath ceil()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。