这个 JAVA朗,数学。getExponent() 返回用于表示双精度或浮点的无偏指数。 注:
null
- 如果论点是正确的 楠 或 极大的 如果是双重或浮动类型,则 后果 是吗( 双重的最大指数+1 )或者( 浮动最大指数+1 ).
- 如果论点是正确的 零 或 次正常 如果是双重或浮动类型,则 后果 是吗( 双重的最小指数-1 )或者( 浮动最小指数-1 ).
语法:
public static int getExponent(DataType a) Parameter : a : an argument of double or float type Return : This method returns the unbiased exponent of the argument.
// Java program to demonstrate working // of java.lang.Math.getExponent() method import java.lang.Math; class Gfg { // driver code public static void main(String args[]) { double a = 345.65 ; double b = 1.0 / 0 ; double c = 0 ; // Input double value // Output unbiased exponent of it System.out.println(Math.getExponent(a)); // Input Infinity // Output (Double.MAX_EXPONENT + 1) System.out.println(Math.getExponent(b)); // Input Zero // Output (Double.MIN_EXPONENT - 1) System.out.println(Math.getExponent(c)); float d = 237 .2f; float e = 1 .0f / 0 ; float f = 0f; // Input float value // Output unbiased exponent of it System.out.println(Math.getExponent(d)); // Input Infinity // Output (Float.MAX_EXPONENT + 1) System.out.println(Math.getExponent(e)); // Input Zero // Output (Float.MIN_EXPONENT - 1) System.out.println(Math.getExponent(f)); } } |
输出:
8 1024 -1023 7 128 -127
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END