Generates rationals in (0, 1]
| 39 | |
| 40 | // Generates rationals in (0, 1] |
| 41 | static double getDouble01(uint num1, uint num2) { |
| 42 | uint64_t n1 = num1; |
| 43 | uint64_t n2 = num2; |
| 44 | n1 <<= 32; |
| 45 | uint64_t num = n1 | n2; |
| 46 | constexpr double factor = |
| 47 | ((1.0) / |
| 48 | (static_cast<double>(std::numeric_limits<unsigned long long>::max()) + |
| 49 | static_cast<double>(1.0))); |
| 50 | constexpr double half_factor((0.5) * factor); |
| 51 | |
| 52 | return sycl::fma(static_cast<double>(num), factor, half_factor); |
| 53 | } |
| 54 | |
| 55 | // Conversion to doubles adapted from Random123 |
| 56 | constexpr double signed_factor = |
no test coverage detected