MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / getHalf01

Function getHalf01

src/backend/cuda/kernel/random_engine.hpp:95–99  ·  view source on GitHub ↗

Generates rationals in (0, 1]

Source from the content-addressed store, hash-verified

93
94// Generates rationals in (0, 1]
95__device__ static __half getHalf01(uint num) {
96 // convert to ushort before the min operation
97 ushort v = min(max_int_before_infinity, ushort(num));
98 return __hfma(__ushort2half_rn(v), HALF_FACTOR, HALF_HALF_FACTOR);
99}
100
101// Generates rationals in (-1, 1]
102__device__ static __half getHalfNegative11(uint num) {

Callers 2

Calls 2

__hfmaFunction · 0.85
minFunction · 0.50

Tested by

no test coverage detected