Skip to content

Commit 4b4ade5

Browse files
committed
libDRT.h: add spowf.
1 parent 7de196b commit 4b4ade5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

display-transforms/jzdrt/libDRT.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ __DEVICE__ float _sign(float x) {
122122
return 0.0f;
123123
}
124124

125+
// Safe power function raising float a to power float b
126+
__DEVICE__ float spowf(float a, float b) {
127+
if (a <= 0.0f) return a;
128+
else return _powf(a, b);
129+
}
130+
125131
__DEVICE__ float3 powf3(float3 a, float b) {
126132
// Raise each component of float3 a to power b
127133
return make_float3(_powf(a.x, b), _powf(a.y, b), _powf(a.z, b));

0 commit comments

Comments
 (0)