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
);
#define cbrt(X) // Requires C11 or higher

パラメーター

x
浮動小数点値

戻り値

cbrt 関数は、x の立方根を返します。

入力 SEH 例外 _matherr 例外
± INF、QNaN、IND なし なし

解説

C++ ではオーバーロードが可能であるため、cbrt または float 型を受け取る long double のオーバーロードを呼び出すことができます。 C プログラムでは、tgmath.h マクロを<使用してこの関数を呼び出さない限り、cbrt常に受け取って返しますdouble。>

<tgmath.h>cbrt() マクロを使用する場合は、引数の型によって、この関数のどのバージョンが選択されるかが決定されます。 詳細については、「ジェネリック型数値演算」を参照してください。

既定では、この関数のグローバル状態の適用対象は、アプリケーションになります。 この動作を変更するには、「CRT のグローバル状態」を参照してください

必要条件

機能 C ヘッダー C++ ヘッダー
cbrt, cbrtf, cbrtl <math.h> <cmath>
cbrt マクロ <tgmath.h>

互換性の詳細については、「 Compatibility」を参照してください。

// 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);
}
The cube root of -64.64 is -4.013289

関連項目

数学と浮動小数点のサポート
exp, expf, expl
log, logf, log10, log10f
pow, powf, powl