Generates rationals in (0, 1]
| 78 | |
| 79 | // Generates rationals in (0, 1] |
| 80 | __device__ static __half oneMinusGetHalf01(uint num) { |
| 81 | // convert to ushort before the min operation |
| 82 | ushort v = min(max_int_before_infinity, ushort(num)); |
| 83 | #if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 530 |
| 84 | return (1.0f - __half2float(__hfma(__ushort2half_rn(v), HALF_FACTOR, |
| 85 | HALF_HALF_FACTOR))); |
| 86 | #else |
| 87 | __half out = __ushort_as_half(0x3c00u) /*1.0h*/ - |
| 88 | __hfma(__ushort2half_rn(v), HALF_FACTOR, HALF_HALF_FACTOR); |
| 89 | if (__hisinf(out)) printf("val: %d ushort: %d\n", num, v); |
| 90 | return out; |
| 91 | #endif |
| 92 | } |
| 93 | |
| 94 | // Generates rationals in (0, 1] |
| 95 | __device__ static __half getHalf01(uint num) { |
no test coverage detected