strictmath

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

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

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

  • cbrt() method is used to find the cube root of the given parameter in the method. Here, cbrt stands for cube root.

    cbrt()方法用于查找方法中给定参数的立方根。 在这里, cbrt代表cube root

  • cbrt() 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 we will not get an error.

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

  • In this method, if we pass a positive parameter so it returns the cube root of the given parameter with the same sign(Positive) else if we pass negative parameter so it returns the cube root of the given parameter with the same sign(Negative).

    在此方法中,如果传递正参数,则返回给定参数的立方根(正);否则,传递负参数,使它返回给定参数的立方根(负) 。

  • cbrt() method does not throw any exception.

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

Syntax:

句法:

    public static double cbrt(double d);

Parameter(s):

参数:

  • double d – represents a double type value whose cube root to be found.

    double d –表示要查找其立方根的double类型值。

Return value:

返回值:

The return type of this method is double – it returns the cube root of given angle.

此方法的返回类型为double-返回给定角度的立方根。

Note:

注意:

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

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

  • If we pass zero (0), method returns the same value with the same sign.

    如果传递零(0),则方法将返回具有相同符号的相同值。

  • If we pass an infinity, method returns the same value with the same sign.

    如果我们传递一个无穷大,则方法将返回带有相同符号的相同值。

Example:

例:

// Java program to demonstrate the example
// of  cbrt(double d) method of StrictMath Class.
public class Cbrt {public static void main(String[] args) {// variable declarations
double d1 = -0.0;
double d2 = 0.0;
double d3 = -7.0 / 0.0;
double d4 = 7.0 / 0.0;
double d5 = 1000.0;
double d6 = -1000.0;
// Display previous value of d1,d2,d3,d4,d5 and d6
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);
System.out.println("d6: " + d6);
// Here , we will get (-0.0) because we are
// passing parameter (-0.0) so the cube root is the same
System.out.println("StrictMath.cbrt(d1): " + StrictMath.cbrt(d1));
// Here , we will get (0.0) because we are
// passing parameter (0.0) so the cube root is the same
System.out.println("StrictMath.cbrt(d2): " + StrictMath.cbrt(d2));
// Here , we will get (-Infinity) because we are
// passing parameter (-7.0/0.0) so the cube root is (-Infinity)
System.out.println("StrictMath.cbrt(d3): " + StrictMath.cbrt(d3));
// Here , we will get (Infinity) because we are
// passing parameter (7.0/0.0) so the cube root is (Infinity)
System.out.println("StrictMath.cbrt(d4): " + StrictMath.cbrt(d4));
// Here , we will get (10.0) because we are
// passing parameter (1000.0) so the cube root is 10.0
System.out.println("StrictMath.cbrt(d5): " + StrictMath.cbrt(d5));
// Here , we will get (-10.0) because we are
// passing parameter (-1000.0) so the cube root is (-10.0)
System.out.println("StrictMath.cbrt(d6): " + StrictMath.cbrt(d6));
}
}

Output

输出量

d1: -0.0
d2: 0.0
d3: -Infinity
d4: Infinity
d5: 1000.0
d6: -1000.0
StrictMath.cbrt(d1): -0.0
StrictMath.cbrt(d2): 0.0
StrictMath.cbrt(d3): -Infinity
StrictMath.cbrt(d4): Infinity
StrictMath.cbrt(d5): 10.0
StrictMath.cbrt(d6): -10.0

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

strictmath

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

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

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

  2. java fastmethod_Java FastMath.cbrt方法代码示例

    import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类 /** Compute nth root of a derivat ...

  3. math的用法在java中的使用,Java Math cbrt() 使用方法及示例

    Java Math cbrt() 使用方法及示例 Java Math cbrt()方法返回指定数字的立方根. cbrt()方法的语法为: Math.cbrt(double num) 注意:cbrt() ...

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

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

  5. java中立方根方法,Java Math.cbrt() 方法

    Java Math.cbrt() 方法 java.lang.Math.cbrt() 用于返回一个数的立方根. 1 语法 public static double cbrt(double x) 2 参数 ...

  6. java hypot_Java StrictMath hypot()方法

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

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

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

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

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

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

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

最新文章

  1. java服务器测试_正确的方法来测试服务器是否在Java中运行?
  2. shell输出没有换行符
  3. 从CLR GC到CoreCLR GC看.NET Core为云而生
  4. php post授权编写,php模拟post行为代码总结(POST方式不是绝对安全)
  5. 【HNOI2015】接水果【整体二分】【DFS序】【双区间转矩形】【扫描线】【树状数组】
  6. 【转】想成为为一名架构师,应该掌握哪些技术呢?
  7. 天翼校园网电脑端实现共享WiFi,解决一机一账号上线的问题! 亲测有效!!!
  8. SSD固态硬盘检测工具AS SSD参数
  9. 微信公众号支付 java_微信公众号支付开发全过程(java版)
  10. 凯恩帝绝对坐标清零_凯恩帝 K90T i 数控车床系统使用手册分享
  11. 暴力破解zip,rar密码
  12. Spring Boot对Ajax跨域访问的支持实现
  13. 现金流量表编制(经典总结)
  14. MATLAB教程(1) MATLAB 基础知识(转)
  15. 一种简明易懂的专利侵权分析报告表单样式
  16. 另一程序正在使用此文件,进程无法访问
  17. 广东计算机复试英语翻译,广东考研指南:参加研究生复试,英语面试自我介绍技巧...
  18. csp认证考试准备Day-1
  19. 建筑市场监管平台解密
  20. 那些年我们一起的CSDN

热门文章

  1. edger多组差异性分析_用R实现批量差异分析(t检验和方差分析),自己算P值
  2. SCSI与USB的关系
  3. 一阶微分方程的物理意义_微分方程和积分方程有哪些典型的物理意义?实际中哪个更常用?...
  4. 游戏运动模糊技术讲解
  5. oracle的ofs,OFS_Oracle11g_Windows2008R2
  6. 伪元素写竖线_[CSS] 用伪元素:after实现分割线和气泡
  7. 常用服务器查询日志命令(持续添加)
  8. GNU Radio: USRP2 and N2x0 Series
  9. 图片水印怎么去掉?图片水印去除方法
  10. vue 监听键盘回车事件 @keyup.enter || @keyup.enter.native