Generates rationals in (0, 1]
| 74 | |
| 75 | // Generates rationals in (0, 1] |
| 76 | sycl::half getHalf01(uint num, uint index) { |
| 77 | sycl::half v = static_cast<sycl::half>(min(MAX_INT_BEFORE_INFINITY, |
| 78 | static_cast<ushort>(num >> (16U * (index & 1U)) & 0x0000ffff))); |
| 79 | |
| 80 | const sycl::half half_factor{1.526e-5}; // (1 / (USHRT_MAX + 1)) |
| 81 | const sycl::half half_half_factor{7.6e-6}; // (0.5 * half_factor) |
| 82 | return sycl::fma(v, half_factor, half_half_factor); |
| 83 | } |
| 84 | |
| 85 | sycl::half oneMinusGetHalf01(uint num, uint index) { |
| 86 | return static_cast<sycl::half>(1.) - getHalf01(num, index); |
no test coverage detected