Generates rationals in (-1, 1]
| 88 | |
| 89 | // Generates rationals in (-1, 1] |
| 90 | sycl::half getHalfNegative11(uint num, uint index) { |
| 91 | sycl::half v = static_cast<sycl::half>(min(MAX_INT_BEFORE_INFINITY, |
| 92 | static_cast<ushort>(num >> (16U * (index & 1U)) & 0x0000ffff))); |
| 93 | |
| 94 | const sycl::half signed_half_factor{3.05e-5}; // (1 / (SHRT_MAX + 1)) |
| 95 | const sycl::half signed_half_half_factor{1.526e-5}; // (0.5 * signed_half_factor) |
| 96 | return sycl::fma(v, signed_half_factor, signed_half_half_factor); |
| 97 | } |
| 98 | |
| 99 | namespace { |
| 100 | template<typename T> |
no test coverage detected