Generates rationals in (-1, 1]
| 79 | |
| 80 | // Generates rationals in (-1, 1] |
| 81 | static arrayfire::common::half getHalfNegative11(uint *val, uint index) { |
| 82 | float v = val[index >> 1U] >> (16U * (index & 1U)) & 0x0000ffff; |
| 83 | // Conversion to half adapted from Random123 |
| 84 | constexpr float factor = |
| 85 | ((1.0f) / (std::numeric_limits<short>::max() + (1.0f))); |
| 86 | constexpr float half_factor = ((0.5f) * factor); |
| 87 | |
| 88 | return static_cast<arrayfire::common::half>(fmaf(v, factor, half_factor)); |
| 89 | } |
| 90 | |
| 91 | // Generates rationals in [0, 1) |
| 92 | double getDouble01(uint *val, uint index) { |
no test coverage detected