math.pow int_Java Math类static int getExponent(double d)与示例

math.pow int

数学类静态int getExponent(double d) (Math Class static int getExponent(double d))

  • This method is available in java.lang package.

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

  • This method is used to return the unbiased exponent used in the denotation of the given argument(i.e. the argument is of double type).

    此方法用于返回在给定参数的表示中使用的无偏指数(即,该参数为double类型)。

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

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

  • The return type of this method is double that means it returns the unbiased exponent of the given argument and the argument value is of double type.

    此方法的返回类型为double,这意味着它将返回给定参数的无偏指数,并且参数值为double类型。

  • In this method, we pass only one parameter as an argument in the method of Math class.

    在此方法中,我们仅将一个参数作为参数传递给Math类的方法。

  • This method does not throw any exception.

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

  • This is an overloaded method so two versions of this method is available one is of double type argument and other is float type argument but here we have discussed double type argument.

    这是一个重载方法,因此该方法有两个版本,一个是双精度类型实参,另一个是浮点型实参,但是这里我们讨论了双精度实参。

Syntax:

句法:

    public static int getExponent(double d){
    }

Parameter(s):

参数:

double d – A double value whose unbiased exponent to be found.

double d-一个double值,将找到其无偏指数。

Note:

注意:

  • If we pass "NaN", it returns Double.MAX_EXPONENT +1.

    如果传递“ NaN”,则返回Double.MAX_EXPONENT +1 。

  • If we pass a positive or negative infinity, it returns Double.MAX_EXPONENT.

    如果传递正负无穷大,则返回Double.MAX_EXPONENT 。

  • If we pass zero (-0 or 0), it returns Double.MIN_EXPONENT - 1.

    如果传递零(-0或0),则返回Double.MIN_EXPONENT-1 。

Return value:

返回值:

The return type of this method is double, it returns the unbiased exponent of the given value.

此方法的返回类型为double ,它返回给定值的无偏指数。

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

// Java program to demonstrate the example of getExponent(double d) 
// method of Math Class

public class GetExponentMethod {
    public static void main(String[] args) {
        // Here we are declaring few variables
        double d1 = 7.0 / 0.0;
        double d2 = -7.0 / 0.0;
        double d3 = 0.0;
        double d4 = -0.0;
        double d5 = 12485.2;

        // Display previous value of d1,d2,d3,d4 andd5  
        System.out.println(" Before implementing getExponent() so the value of d1 is :" + d1);
        System.out.println(" Before implementing getExponent() so the value of d2 is :" + d2);
        System.out.println(" Before implementing getExponent() so the value of d3 is :" + d3);
        System.out.println(" Before implementing getExponent() so the value of d4 is :" + d4);
        System.out.println(" Before implementing getExponent() so the value of d5 is :" + d5);

        // Here , we will get (Double.MAX_EXPONENT) because we are 
        // passing parameter whose value is (infinity)
        System.out.println("After implementing getExponent() so the value of d1 is :" + Math.getExponent(d1));

        // Here , we will get (Double.MAX_EXPONENT) because we are 
        // passing parameter whose value is (-infinity)
        System.out.println("After implementing getExponent() so the value of d2 is :" + Math.getExponent(d2));

        // Here , we will get (Double.MIN_EXPONENT - 1) because we are 
        // passing parameter whose value is (0.0)
        System.out.println("After implementing getExponent() so the value of d3 is :" + Math.getExponent(d3));

        // Here , we will get (Double.MIN_EXPONENT - 1) because we are 
        // passing parameter whose value is (-0.0)
        System.out.println("After implementing getExponent() so the value of d4 is :" + Math.getExponent(d4));

        // Here , we will get unbiased exponent because we are 
        // passing parameter whose value is (12485.2)
        System.out.println("After implementing getExponent() so the value of d5 is :" + Math.getExponent(d5));
    }
}

Output

输出量

E:\Programs>javac GetExponentMethod.java

E:\Programs>java GetExponentMethod
Before implementing getExponent() so the value of d1 is :Infinity
Before implementing getExponent() so the value of d2 is :-Infinity
Before implementing getExponent() so the value of d3 is :0.0
Before implementing getExponent() so the value of d4 is :-0.0
Before implementing getExponent() so the value of d5 is :12485.2

After implementing getExponent() so the value of d1 is :1024
After implementing getExponent() so the value of d2 is :1024
After implementing getExponent() so the value of d3 is :-1023
After implementing getExponent () so the value of d4 is :-1023
After implementing getExponent() so the value of d5 is :13


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

math.pow int

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值