cbrt、cbrtf、cbrtl

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 later

參數

x

浮點值。

傳回值

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

輸入

SEH 例外狀況

_matherr 例外

± INF、QNaN、IND

none

none

備註

因為 C++ 允許多載,所以您可以呼叫採用 cbrt 和 float 類型的 long double 的多載。 在 C 程式中,除非您使用 巨集來呼叫此函式, cbrt 否則一律會採用 並傳 double回 。

如果您使用 cbrt() 巨集,則引數的型別會決定選取哪一個函式版本。 如需詳細資料,請參閱型別泛型數學。

根據預設,此函式的全域狀態會限定於應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。

需求

函式

C 標頭

C++ 標頭

cbrt、 、 cbrtfcbrtl

cbrt 巨集

如需相容性詳細資訊,請參閱相容性。

範例

// crt_cbrt.c

// Compile using: cl /W4 crt_cbrt.c

// This program calculates a cube root.

#include

#include

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、 、 expfexpl

log、 、 logf、 log10log10f

pow、 、 powfpowl

相关推荐

海南此次赤潮或于7至10天内逐步消退
365bet足球比

海南此次赤潮或于7至10天内逐步消退

📅 07-07 👁️ 4459
尺侧腕屈肌 - 尺侧腕屈肌锻炼方法图解教程
36365快速检测中心

尺侧腕屈肌 - 尺侧腕屈肌锻炼方法图解教程

📅 01-06 👁️ 713
超实用省钱app合集,谁能帮你省更多?
365bet足球比

超实用省钱app合集,谁能帮你省更多?

📅 11-02 👁️ 5758
20个适合 集体活动/酒吧/KTV 玩的游戏(ktv里面玩的游戏有哪些)
耗时数年,俄罗斯兴奋剂丑闻最终结果出炉
2025微商如何引流:3大秘诀让你客户爆满,日加500+精准好友!