Suppose I want to perform a (single-precision) division of x
by y
in my CUDA kernel, and regardless of anything else, get a rounded-up result (= rounded to positive infinity). This is easy: Instead of:
float r = x / y;
I write :
float r = __fdiv_ru(x, y);
and I could do the same for rn
(round nearest), rd
etc.
How do I do the same thing in OpenCL?
If I look at the documentation for math functions (OpenCL 3.0), I find only find native_divide
, and am told that:
The built-in math functions are not affected by the prevailing rounding mode in the calling environment, and always return the same value as they would if called with the round to nearest even rounding mode.
so, ,that's not the way to go. What do I do?