
v2: don't use assume check only for x<0, the other conditions are handled transparently v3: don't check inputs at all, nan propagation works as expected Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 318204
6 lines
217 B
C++
6 lines
217 B
C++
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_powr(__CLC_GENTYPE x, __CLC_GENTYPE y) {
|
|
// x^y == 2^{log2 x^y} == 2^{y * log2 x}
|
|
// for x < 0 propagate nan created by log2
|
|
return native_exp2(y * native_log2(x));
|
|
}
|