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

Function getHalfNegative11

src/backend/oneapi/kernel/random_engine_write.hpp:90–97  ·  view source on GitHub ↗

Generates rationals in (-1, 1]

Source from the content-addressed store, hash-verified

88
89// Generates rationals in (-1, 1]
90sycl::half getHalfNegative11(uint num, uint index) {
91 sycl::half v = static_cast<sycl::half>(min(MAX_INT_BEFORE_INFINITY,
92 static_cast<ushort>(num >> (16U * (index & 1U)) & 0x0000ffff)));
93
94 const sycl::half signed_half_factor{3.05e-5}; // (1 / (SHRT_MAX + 1))
95 const sycl::half signed_half_half_factor{1.526e-5}; // (0.5 * signed_half_factor)
96 return sycl::fma(v, signed_half_factor, signed_half_half_factor);
97}
98
99namespace {
100template<typename T>

Callers 2

Calls 2

fmaFunction · 0.85
minFunction · 0.50

Tested by

no test coverage detected