函式
<cmath> <ctgmath>

cbrt

     double cbrt  (double x);      float cbrtf (float x);long double cbrtl (long double x);
     double cbrt (double x);      float cbrt (float x);long double cbrt (long double x);     double cbrt (T x);           // additional overloads for integral types
計算立方根
返回 x立方根

標頭檔案 <tgmath.h> 提供了此函式的型別通用宏版本。
此標頭(<cmath>)中為整型型別提供了附加過載:這些過載在計算前有效地將 x 強制轉換為 double(為所有整型 T 定義)。

引數

x
計算立方根的值。

返回值

x 的立方根。

示例

1
2
3
4
5
6
7
8
9
10
11
12
/* cbrt example */
#include <stdio.h>      /* printf */
#include <math.h>       /* cbrt */

int main ()
{
  double param, result;
  param = 27.0;
  result = cbrt (param);
  printf ("cbrt (%f) = %f\n", param, result);
  return 0;
}

輸出

cbrt (27.000000) = 3.000000


另見