次の方法で共有


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

none

none

解説

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