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

Function getDouble01

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

Generates rationals in (0, 1]

Source from the content-addressed store, hash-verified

39
40// Generates rationals in (0, 1]
41static double getDouble01(uint num1, uint num2) {
42 uint64_t n1 = num1;
43 uint64_t n2 = num2;
44 n1 <<= 32;
45 uint64_t num = n1 | n2;
46 constexpr double factor =
47 ((1.0) /
48 (static_cast<double>(std::numeric_limits<unsigned long long>::max()) +
49 static_cast<double>(1.0)));
50 constexpr double half_factor((0.5) * factor);
51
52 return sycl::fma(static_cast<double>(num), factor, half_factor);
53}
54
55// Conversion to doubles adapted from Random123
56constexpr double signed_factor =

Callers 4

writeOut128BytesFunction · 0.70
partialWriteOut128BytesFunction · 0.70

Calls 2

fmaFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected