博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
strictmath_Java StrictMath pow()方法与示例
阅读量:2535 次
发布时间:2019-05-11

本文共 2318 字,大约阅读时间需要 7 分钟。

strictmath

StrictMath类pow()方法 (StrictMath Class pow() method)

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

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

  • pow() method is used to calculate the power of the given arguments or in other words, it returns the value of the first parameter raised to the power of the second parameter.

    pow()方法用于计算给定参数的幂,换句话说,它将第一个参数的值返回为第二个参数的幂。

  • pow() method is a static method and it is accessible with the class name and if we try to access the method with the class object then we will not get any error.

    pow()方法是一个静态方法,可以使用类名进行访问,如果尝试使用类对象访问该方法,则不会出现任何错误。

  • pow() method does not throw any exception at the time of calculating the power of the given arguments.

    pow()方法在计算给定参数的功效时不会引发任何异常。

Syntax:

句法:

public static double pow(double base , double exponent);

Parameter(s):

参数:

  • base – represents the base.

    base –代表基数。

  • exponent – represents the power (exponent).

    指数 –表示幂(指数)。

Return value:

返回值:

The return type of this method is double – it returns the base raised to the power of exponent.

此方法的返回类型为double-将返回的底数返回指数幂。

Note:

注意:

  • If we pass NaN as the first argument and a non-zero value as the second argument, the method returns NaN.

    如果我们将NaN作为第一个参数传递,并将非零值作为第二个参数传递,则该方法将返回NaN。

  • If we pass NaN as the second argument, the method returns NaN.

    如果我们将NaN作为第二个参数传递,则该方法将返回NaN。

  • If we pass 1.0 as the second argument, the method returns the value of the first argument.

    如果我们将1.0作为第二个参数传递,则该方法将返回第一个参数的值。

  • If we pass 0 (native or positive) as the second argument, the method returns 1.0.

    如果我们将0(正数或正数)作为第二个参数传递,则该方法返回1.0。

Example:

例:

// Java program to demonstrate the example of // pow(double base , double exponent) method of StrictMath Class.public class Pow {
public static void main(String[] args) {
// Variable Declarations double d1 = 2.0; double d2 = 3.0; double d3 = 4.0; double d4 = 6.0; // Here , we will get (d1 raised to the power of d2) // because we are passing parameter (2.0,3.0) System.out.println("StrictMath.pow(d1,d2): " + StrictMath.pow(d1, d2)); // Here , we will get (d3 raised to the power of d4) // because we are passing parameter (4.0,6.0) System.out.println("StrictMath.pow(d3,d4): " + StrictMath.pow(d3, d4)); }}

Output

输出量

StrictMath.pow(d1,d2): 8.0StrictMath.pow(d3,d4): 4096.0

翻译自:

strictmath

转载地址:http://mjvzd.baihongyu.com/

你可能感兴趣的文章
mysql中间件研究(tddl atlas cobar sharding-jdbc)
查看>>
Cast-128 加密算法和 MyPassWord 的破解
查看>>
4.28下午 听力611
查看>>
ActiveMQ学习笔记(1)----初识ActiveMQ
查看>>
Java与算法之(2) - 快速排序
查看>>
Windows之IOCP
查看>>
机器学习降维之主成分分析
查看>>
CTP2交易所成交回报
查看>>
WebSocket & websockets
查看>>
《机器学习实战》学习笔记第二章 —— K-近邻算法
查看>>
uni-app 引入本地iconfont的正确姿势以及阿里图标引入
查看>>
DSB
查看>>
Java中的阻塞队列
查看>>
前端软件sublime的一些常用快捷键
查看>>
openssl 升级
查看>>
2017.10.30 天晴 昨天十公里没减肥
查看>>
Git 打标签(分布式版本控制系统)
查看>>
ASP.NET MVC:通过 FileResult 向 浏览器 发送文件
查看>>
CVE-2010-2883Adobe Reader和Acrobat CoolType.dll栈缓冲区溢出漏洞分析
查看>>
使用正确的姿势跨域
查看>>