Generates rationals in (0, 1]
| 131 | |
| 132 | // Generates rationals in (0, 1] |
| 133 | __device__ static double getDouble01(uint num1, uint num2) { |
| 134 | uint64_t n1 = num1; |
| 135 | uint64_t n2 = num2; |
| 136 | n1 <<= 32; |
| 137 | uint64_t num = n1 | n2; |
| 138 | constexpr double factor = |
| 139 | ((1.0) / (std::numeric_limits<unsigned long long>::max() + |
| 140 | static_cast<double>(1.0))); |
| 141 | constexpr double half_factor((0.5) * factor); |
| 142 | |
| 143 | return fma(static_cast<double>(num), factor, half_factor); |
| 144 | } |
| 145 | |
| 146 | // Conversion to doubles adapted from Random123 |
| 147 | constexpr double signed_factor = |
no test coverage detected