这个 JAVA朗,数学。nextUp() 是java中的一个内置数学函数,它返回与提供的参数相邻的正无穷大方向的浮点值。 nextUp() 方法重载,这意味着在Math类下有多个同名的方法。nextUp()的两个重载方法:
null
- 双重类型: NEX(双倍)
- 浮动类型: 下一步(浮动f)
注:
- 如果论点是正确的 楠 这个 后果 是 楠 .
- 如果论点是正确的 零 这个 后果 是 双重的最小值 如果我们正在处理 双重的 如果是 浮动 然后 后果 是 浮动最小值 .
- 如果论点是正确的 正无穷大 这个 后果 是 正无穷大 .
语法:
public static dataType nextUp(dataType g) Parameter : g : an input for starting floating-point value. Return : The nextUp() method returns the adjacent floating-point value closer to positive infinity.
例子: 表示工作 JAVA朗,数学。nextUp() 方法
// Java program to demonstrate working // of java.lang.Math.nextUp() method import java.lang.Math; class Gfg { // driver code public static void main(String args[]) { double g = 69.19 ; // Input double value, Output adjacent floating-point System.out.println(Math.nextUp(g)); float gf = 78 .1f; // Input float value, Output adjacent floating-point System.out.println(Math.nextUp(gf)); double a = 0.0 / 0 ; // Input NaN, Output NaN System.out.println(Math.nextUp(a)); float b = 0 .0f; // Input zero, Output Float.MIN_VALUE for float System.out.println(Math.nextUp(b)); double c = 1.0 / 0 ; // Input positive infinity, Output positive infinity System.out.println(Math.nextUp(c)); } } |
输出:
69.19000000000001 78.100006 NaN 1.4E-45 Infinity
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END