summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorJean-Luc Brouillet <jeanluc@google.com>2014-03-07 18:00:57 -0800
committerJean-Luc Brouillet <jeanluc@google.com>2014-03-07 18:00:57 -0800
commitbcd5b9af756d10317faf54fa3742f89dfacef152 (patch)
treeb0f08ce4164aa68cd71cb961e78786878a43e4a4 /driver
parentd41722ce05351cebd6ff498d762f74a4aea6b1be (diff)
downloadrs-bcd5b9af756d10317faf54fa3742f89dfacef152.tar.gz
Enable more advanced CTS tests.
Add the possibility to make the generated random values for one argument be dependent on another one. Add the possibility to add precision limits. Change the way precision of results is verified. This is a redo of the mess that's CL 84333 and 84332 Change-Id: I6c59ee4588627540b5bf1952adaf70b061ccc025
Diffstat (limited to 'driver')
-rw-r--r--driver/runtime/rs_cl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/runtime/rs_cl.c b/driver/runtime/rs_cl.c
index 3a9252a9..d054bcf1 100644
--- a/driver/runtime/rs_cl.c
+++ b/driver/runtime/rs_cl.c
@@ -515,9 +515,10 @@ FN_FUNC_FN_FN(pow)
extern float __attribute__((overloadable)) pown(float v, int p) {
/* The mantissa of a float has fewer bits than an int (24 effective vs. 31).
* For very large ints, we'll lose whether the exponent is even or odd, making
- * the selection of a correct sign incorrect. We correct this.
+ * the selection of a correct sign incorrect. We correct this. Use copysign
+ * to handle the negative zero case.
*/
- float sign = (v < 0.0f && (p & 0x1)) ? -1.0 : 1.0;
+ float sign = (p & 0x1) ? copysign(1.f, v) : 1.f;
float f = pow(v, (float)p);
return copysign(f, sign);
}