共用方式為


cbrt、cbrtf、cbrtl

計算立方根。

double cbrt(    double x  ); float cbrt(    float x  );  // C++ only long double cbrt(    long double x );  // C++ only float cbrtf(    float x  ); long double cbrtl(    long double x );

參數

  • x
    浮點值。

傳回值

cbrt 函式會傳回 x 的立方根。

輸入

SEH 例外狀況

_matherr 例外狀況

± ∞、QNAN、IND

備註

因為 C++ 允許多載,所以您可以呼叫採用 float 和 long double 類型的 cbrt 的多載。 在 C 程式中,cbrt 會一律採用並傳回 double。

需求

函式

C 標頭

C++ 標頭

cbrt, cbrtf, cbrtl

<math.h>

<cmath>

如需其他相容性資訊,請參閱 相容性

範例

// crt_cbrt.c
// Compile using: cl /W4 crt_cbrt.c
// This program calculates a cube root.

#include <math.h>
#include <stdio.h>

int main( void )
{
   double question = -64.64;
   double answer;

   answer = cbrt(question);
   printf("The cube root of %.2f is %.6f\n", question, answer);
}
  

.NET Framework 對等用法

不適用。若要呼叫標準 C 函式,請使用 PInvoke。如需詳細資訊,請參閱平台叫用範例

請參閱

參考

浮點支援

exp、expf

log、logf、log10、log10f

pow、powf、powl