-
Notifications
You must be signed in to change notification settings - Fork 11
pow()
it's /me edited this page Mar 2, 2021
·
2 revisions
There are shader translations in which unexpected results occur as a result of a pow calculation. This is due to the different handling of the result. The problem can be eliminated with the help of this substitute function:
// corrected pow-function by Chris Ridings
__DEVICE__ float powcf(float x, float y) {
float ret = _powf(x,y);
if (isnan(ret))
return 0.0001f;
return ret;
}
Alternative method
__DEVICE__ float lpowf(float a, float b) {
return _expf(b * _logf(a));
}