double pow( double x, double y );
float powf( float x, float y );
long double powl( long double x, long double y );
define pow(X, Y) // Requires C11 or higher
double pow( double x, int y ); // C++ only
float pow( float x, float y ); // C++ only
float pow( float x, int y ); // C++ only
long double pow( long double x, long double y ); // C++ only
long double pow( long double x, int y ); // C++ only
Base:
傳回 的值 x
y
。 溢位或反向溢位時不會列印錯誤訊息。
x
和 的值y
的傳回值 pow
pow
無法辨識大於 264 (的整數浮點值,例如 1.0E100) 。
pow
具有使用 Streaming SIMD Extensions 2 (SSE2) 的實作。 如需使用 SSE2 實作的相關資訊和限制,請參閱 _set_SSE2_enable
。
因為 C++ 允許多載,所以您可以呼叫 pow
的各種多載。 在 C 程式中,除非您使用 <tgmath.h>
宏呼叫此函式,否則一 pow
律會接受兩 double
個 double
值並傳回值。
如果您使用 pow
的 <tgmath.h>
宏,引數的類型會決定選取的函式版本。 如需詳細資訊,請參閱 類型泛型數學 。
pow(int, int)
已無法使用。 如果您使用這個多載,編譯器可能會發出 C2668。 若要避免這個問題,請將第一個參數轉換為 double
、float
或 long double
。
最初,多 pow(T, int)
載會將呼叫取消註冊 pow
為一連串的內嵌乘法運算。 雖然速度較快,但也比較不精確。 Visual Studio 2015 Update 1 已移除此實作。 如需詳細資訊,請參閱 Visual Studio 2015 Update 1 中的一致性改善。
根據預設,此函式的全域狀態會限定為應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
常式傳回的值
必要的標頭 (C)
必要的標頭 (C++)