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

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

strictmath

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

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

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

  • exp() method is used to return the exponential of the given number in the method or other words it is used to calculate the e raised to the power of the given argument. Here, exp stands for exponentiation.

    exp()方法用于返回该方法中给定数字的指数,或者换句话说,它用于计算提高到给定参数幂的e。 在这里,exp代表幂运算。

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

    exp()方法是静态方法,因此可以使用类名进行访问,如果尝试使用类对象访问该方法,则也不会收到错误。

  • exp() method does not throw any exception.

    exp()方法不会引发任何异常。

Syntax:

句法:

public static double exp(double d);

Parameter(s):

参数:

  • double d – represents the double type value whose exponential value to be found.

    double d –表示要找到其指数值的double类型值。

Return value:

返回值:

The return type of this method is double – it returns exponential value of the given parameter.

此方法的返回类型为double-它返回给定参数的指数值。

Note:

注意:

  • If we pass NaN as an argument, method returns the same value (NaN).

    如果我们将NaN作为参数传递,则方法将返回相同的值(NaN)。

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

    如果我们传递一个正无穷大,则方法将返回相同的值(即正无穷大)。

  • If we pass a negative infinity, method returns 0.0.

    如果我们传递一个负无穷大,则方法返回0.0。

Example:

例:

// Java program to demonstrate the example// of exp(double d) method of StrictMath Class.public class Exp {
public static void main(String[] args) {
// variable declarations double d1 = 7.0 / 0.0; double d2 = -7.0 / 0.0; double d3 = 0.8; double d4 = 2; // 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); // Here , we will get (Infinity) because we are // passing parameter whose value is (infinity) System.out.println("StrictMath.exp(d1): " + StrictMath.exp(d1)); // Here , we will get (0.0) because we are // passing parameter whose value is (-infinity) System.out.println("StrictMath.exp(d2): " + StrictMath.exp(d2)); // Here , we will get (e raised to the power of 0.8) because we are // passing parameter whose value is (0.8) System.out.println("StrictMath.exp(d3): " + StrictMath.exp(d3)); // Here , we will get ( e raised to the power of 2) because we are // passing parameter whose value is (2) System.out.println("StrictMath.exp(d4): " + StrictMath.exp(d4)); }}

Output

输出量

d1: Infinityd2: -Infinityd3: 0.8d4: 2.0StrictMath.exp(d1): InfinityStrictMath.exp(d2): 0.0StrictMath.exp(d3): 2.225540928492468StrictMath.exp(d4): 7.38905609893065

翻译自:

strictmath

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

你可能感兴趣的文章
valgrind检测linux程序内存泄露
查看>>
Hadoop以及组件介绍
查看>>
1020 Tree Traversals (25)(25 point(s))
查看>>
第一次作业
查看>>
“==”运算符与equals()
查看>>
单工、半双工和全双工的定义
查看>>
Hdu【线段树】基础题.cpp
查看>>
时钟系统
查看>>
BiTree
查看>>
5个基于HTML5的加载动画推荐
查看>>
水平权限漏洞的修复方案
查看>>
静态链接与动态链接的区别
查看>>
Android 关于悬浮窗权限的问题
查看>>
如何使用mysql
查看>>
linux下wc命令详解
查看>>
敏捷开发中软件测试团队的职责和产出是什么?
查看>>
在mvc3中使用ffmpeg对上传视频进行截图和转换格式
查看>>
python的字符串内建函数
查看>>
Spring - DI
查看>>
微软自己的官网介绍 SSL 参数相关
查看>>