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

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

strictmath_Java StrictMath nextUp()方法与示例

發(fā)布時(shí)間:2025/3/11 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 strictmath_Java StrictMath nextUp()方法与示例 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

strictmath

StrictMath類(lèi)nextUp()方法 (StrictMath Class nextUp() method)

Syntax:

句法:

public static float nextUp(float fl);public static double nextUp(double do);
  • nextUp() method is available in java.lang package.

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

  • nextUp(float fl) method is used to return the float floating-point number adjacent to the given argument (fl) in the direction of the path of infinity.

    nextUp(float fl)方法用于返回沿?zé)o窮大路徑方向與給定參數(shù)(fl)相鄰的float浮點(diǎn)數(shù)。

  • nextUp(double do) method is used to return the double floating-point number adjacent to the given argument (do) in the direction of the path of infinity.

    nextUp(double do)方法用于在無(wú)窮大路徑的方向上返回與給定參數(shù)(do)相鄰的雙浮點(diǎn)數(shù)。

  • These methods don't throw an exception.

    這些方法不會(huì)引發(fā)異常。

  • These are static methods, it is accessible with the class name and, if we try to access these methods with the class object then we will not get any error.

    這些是靜態(tài)方法,可以通過(guò)類(lèi)名進(jìn)行訪問(wèn),如果嘗試使用類(lèi)對(duì)象訪問(wèn)這些方法,則不會(huì)出現(xiàn)任何錯(cuò)誤。

Parameter(s):

參數(shù):

  • float fl/ double do – it represents the initial or starting floating-point value of float or double type.

    float fl / double do –表示float或double類(lèi)型的初始或起始浮點(diǎn)值。

Return value:

返回值:

The return type of this method is float / double – it returns the floating-point number adjacent to the given parameter which is nearby infinity.

此方法的返回類(lèi)型為float / double-返回與給定參數(shù)(無(wú)窮大附近)相鄰的浮點(diǎn)數(shù)。

Note:

注意:

  • If we pass NaN, the method returns NaN.

    如果傳遞NaN,則該方法返回NaN。

  • If we pass a positive infinity, the methods returns the same (i.e. a positive infinity).

    如果我們傳遞一個(gè)正無(wú)窮大,則這些方法將返回相同的值(即一個(gè)正無(wú)窮大)。

  • If we pass 0 (positive or negative), the method returns Float.MIN_VALUE / Double.MIN_VALUE.

    如果傳遞0(正數(shù)或負(fù)數(shù)),則該方法返回Float.MIN_VALUE / Double.MIN_VALUE 。

Example:

例:

// Java program to demonstrate the example // of nextUp() method of StrictMath classpublic class NextUp {public static void main(String[] args) {// variable declarationsfloat f1 = -0.0f;float f2 = 0.0f;float f3 = -7.0f / 0.0f;float f4 = 7.0f / 0.0f;double d1 = -0.0;double d2 = 0.0;double d3 = -7.0 / 0.0;double d4 = 7.0 / 0.0;// Display previous value of f1,f2,f3 and f4 System.out.println("f1: " + f1);System.out.println("f2: " + f2);System.out.println("f3: " + f3);System.out.println("f4: " + f4);// Display previous value of d1,d2,d3 and d4 System.out.println("d1: " + d1);System.out.println("d2: " + d2);System.out.println("d3: " + d3);System.out.println("d4: " + d4);System.out.println();System.out.println("nextUp(float): ");// Here , we will get (Float.MIN_VALUE) because we are// passing parameter whose value is (-0.0f)System.out.println("StrictMath.nextUp (f1): " + StrictMath.nextUp(f1));// Here , we will get (Float.MIN_VALUE) and we are// passing parameter whose value is (0.0f)System.out.println("StrictMath.nextUp (f2): " + StrictMath.nextUp(f2));// Here , we will get (Infinity) and we are // passing parameter whose value is (7.0f/0.0f)System.out.println("StrictMath.nextUp (f4): " + StrictMath.nextUp(f4));System.out.println();System.out.println("nextUp(float): ");// Here , we will get (Double.MIN_VALUE) because we are// passing parameter whose value is (-0.0)System.out.println("StrictMath.nextUp (d1): " + StrictMath.nextUp(d1));// Here , we will get (Double.MIN_VALUE) and we are // passing parameter whose value is (0.0)System.out.println("StrictMath.nextUp (d2): " + StrictMath.nextUp(d2));// Here , we will get (Infinity) and we are // passing parameter whose value is (7.0/0.0)System.out.println("StrictMath.nextUp (d4): " + StrictMath.nextUp(d4));} }

Output

輸出量

f1: -0.0 f2: 0.0 f3: -Infinity f4: Infinity d1: -0.0 d2: 0.0 d3: -Infinity d4: InfinitynextUp(float): StrictMath.nextUp (f1): 1.4E-45 StrictMath.nextUp (f2): 1.4E-45 StrictMath.nextUp (f4): InfinitynextUp(float): StrictMath.nextUp (d1): 4.9E-324 StrictMath.nextUp (d2): 4.9E-324 StrictMath.nextUp (d4): Infinity

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

strictmath

總結(jié)

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

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。