strictmath

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

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

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

  • log1p() method is used to return (the logarithm of the sum of the given argument and 1 like log(1+d) in the method.

    log1p()方法用于返回(给定参数和1之和的对数,如log(1 + d)在该方法中。

  • log1p() 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.

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

  • We need to remember one thing if we pass smaller values for the given argument so the final calculated result of log1p(d) is nearer to the exact result of ln(1+d) than the double floating-point calculation of log(1.0+d).

    如果为给定参数传递较小的值,则需要记住一件事,即与log(1.0+)的双浮点计算相比, log1p(d)的最终计算结果更接近ln(1 + d)的精确结果。 d)。

  • log1p() method does not throw any exception.

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

Syntax:

句法:

    public static double log1p(double d);

Parameter(s):

参数:

  • double d – represents the double type argument.

    double d –表示double类型的参数。

Return value:

返回值:

The return type of this method is double – it returns the logarithm (1+d) of the given argument.

此方法的返回类型为double-返回给定参数的对数(1 + d)。

Note:

注意:

  • If we pass NaN, method returns NaN.

    如果传递NaN,则方法返回NaN。

  • If we a value which is less than -1, method returns NaN.

    如果我们的值小于-1,则方法返回NaN。

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

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

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

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

  • If we pass 0 (negative or positive), method returns the same with the same sign.

    如果传递0(负数或正数),则方法将返回相同的符号。

Example:

例:

// Java program to demonstrate the example
// of log1p(double d) method of StrictMath class.
public class Log1p {public static void main(String[] args) {// variable declarations
double d1 = 7.0 / 0.0;
double d2 = -7.0 / 0.0;
double d3 = 0.0;
double d4 = -0.0;
double d5 = 6054.2;
// Display previous value of d1,d2,d3,d4 and d5
System.out.println("d1: " + d1);
System.out.println("d2: " + d2);
System.out.println("d3: " + d3);
System.out.println("d4: " + d4);
System.out.println("d5: " + d5);
// Here , we will get (Infinity) because we are
// passing parameter whose value is (Infinity)
System.out.println("StrictMath.log1p(d1): " + StrictMath.log1p(d1));
// Here , we will get (NaN) because we are
// passing parameter whose value is (-Infinity)
System.out.println("StrictMath.log1p(d2): " + StrictMath.log1p(d2));
// Here , we will get (0.0) because we are
// passing parameter whose value is (0.0)
System.out.println("StrictMath.log1p(d3): " + StrictMath.log1p(d3));
// Here , we will get (-0.0) because we are
// passing parameter whose value is (-0.0)
System.out.println("StrictMath.log1p(d4): " + StrictMath.log1p(d4));
// Here , we will get (log [1 + d5]) and we are
// passing parameter whose value is (6054.2)
System.out.println("StrictMath.log1p(d5): " + StrictMath.log1p(d5));
}
}

Output

输出量

d1: Infinity
d2: -Infinity
d3: 0.0
d4: -0.0
d5: 6054.2
StrictMath.log1p(d1): Infinity
StrictMath.log1p(d2): NaN
StrictMath.log1p(d3): 0.0
StrictMath.log1p(d4): -0.0
StrictMath.log1p(d5): 8.708672685994957

翻译自: https://www.includehelp.com/java/strictmath-log1p-method-with-example.aspx

strictmath

strictmath_Java StrictMath log1p()方法与示例相关推荐

  1. java hypot_Java StrictMath hypot()方法与示例

    StrictMath类hypot()方法hypot()方法在java.lang包中可用. hypot()方法用于返回sqrt(sq(d1)+ sq(d2))的平方根,而不进行任何中间运算,换句话说,它 ...

  2. java abs在哪个包,Java StrictMath abs()方法

    Java StrictMath abs()方法 java.lang.StrictMath.abs(float a) 方法返回一个浮点值的绝对值.如果参数不是负数,则返回该参数.如果参数为负数,则返回该 ...

  3. java hypot_Java StrictMath hypot()方法

    Java StrictMath hypot()方法 java.lang.StrictMath.hypot() 方法返回 sqrt(x2 + y2) 没有中间溢或下溢.它包括了一些情况: 如果任一参数为 ...

  4. python torch exp_Python torch.add方法代码示例

    本文整理汇总了Python中torch.add方法的典型用法代码示例.如果您正苦于以下问题:Python torch.add方法的具体用法?Python torch.add怎么用?Python tor ...

  5. .net连接mysql数据_.net连接MYSQL数据库的方法及示例!

    连接MYSQL数据库的方法及示例 方法一: 使用MYSQL推出的MySQL Connector/Net is an ADO.NET driver for MySQL 该组件为MYSQL为ADO.NET ...

  6. set.difference() 的用法(python3)_Python 集合 difference_update() 使用方法及示例

    Python 集合 difference_update() 使用方法及示例 Difference_update()使用集合的差集更新集合,并调用difference_update()方法. 如果A和B ...

  7. doc python 颜色_Python wordcloud.ImageColorGenerator方法代码示例

    本文整理汇总了Python中wordcloud.ImageColorGenerator方法的典型用法代码示例.如果您正苦于以下问题:Python wordcloud.ImageColorGenerat ...

  8. isdigit函数在C语言什么意思,C 库函数 isdigit() 使用方法及示例

    C 库函数 isdigit() 使用方法及示例 isdigit()函数检查字符是否为数字字符(0-9). isdigit()的函数原型int isdigit( int arg ); 函数isdigit ...

  9. python中append的用法_Python 列表 append() 使用方法及示例

    Python 列表 append() 使用方法及示例 append()方法将一个项目添加到列表的末尾. append()方法将单个项目添加到列表的末尾. append()方法的语法为:list.app ...

最新文章

  1. 谈谈Koa 中的next
  2. 抽象工厂+反射+依赖注入 实现对数据访问层和业务逻辑层的优化
  3. Marketing Cloud contact的API介绍
  4. Linux面试题集锦,测测你的水平(答案)四
  5. 工作日志WebRoot--编辑页关于处理两个关联的选择框
  6. 3种团队分组适应项目_团队类型
  7. 非x面容解锁插件ios13_iOS13.5 Beta3 推送,戴口罩解锁更加方便
  8. java oop入门_Java OOP入门起源
  9. 转: jvm调优参数总结
  10. 开源视频平台:ViMP
  11. Atitit.跨语言系统服务管理器api兼容设计
  12. 基于JSP+Servlet的旅游景点服务平台(旅游网站)
  13. 联想android刷机教程,联想YOGA Tablet 2线刷刷机教程 Android版可救砖
  14. 3D Food Printing【3D食物打印】
  15. 技术人该如何选择未来职业方向?一起听听这几位美团同学的故事
  16. python和pyqt5入门之简易汇率转换器
  17. 8583报文格式介绍
  18. 个性化推荐系统设计(3.1)——如何评价个性化推荐系统的效果
  19. boot的时候无法进入BIOS,无法使用键盘
  20. 一些用前缀思想解决的题(持续完善)

热门文章

  1. ext3 tree tbar 初始化定义
  2. (网页)swiper.js轮播图插件
  3. 正确判断js数据类型 总结记录
  4. Vue表格中,对数据进行转换、处理
  5. mysql数据库sql语句优化
  6. JavaScript内置对象Date常用函数
  7. python!!!!惊了,这世上居然还有这么神奇的东西存在
  8. 用js和jQuery做轮播图
  9. WPF笔记(1.1 WPF基础)——Hello,WPF!
  10. 飞信SDK内容【转载】