数学JavaScript中的cbrt()

这个 数学cbrt() 函数用于查找数字的立方根。 数字的立方根表示为数学。cbrt(x)=y使得y^3=x。

null

语法:

Math.cbrt(number)

使用的参数: 编号: 这是你想知道谁的房间号码。

返回值: 它返回给定数字的立方根。

例如:

Input : Math.cbrt(8)
Output : 2
     
Input : Math.cbrt(-8)
Output : -2

Input : Math.cbrt(0)
Output : 0

Input : Math.cbrt(infinity)
Output : Infinity
  1. 当正数作为参数传递时。

    < script type = "text/javascript" >
    document.write("Output : " + Math.cbrt(8));
    </ script >

    
    

    输出:

    Output : 2
  2. 当一个负数作为参数传递时。

    < script type = "text/javascript" >
    document.write("Output : " + Math.cbrt(-8));
    </ script >

    
    

    输出:

    Output : -2
  3. 当零作为参数传递时。

    < script type = "text/javascript" >
    document.write("Output : " + Math.cbrt(0));
    </ script >

    
    

    输出:

    Output : 0
  4. 当无穷大作为参数传递时。

    < script type = "text/javascript" >
    document.write("Output : " + Math.cbrt(infinity));
    </ script >

    
    

    输出:

    Output : Infinity
© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享