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

Function getFloatNegative11

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

Generates rationals in (-1, 1]

Source from the content-addressed store, hash-verified

28
29// Generates rationals in (-1, 1]
30static float getFloatNegative11(uint num) {
31 // Conversion to floats adapted from Random123
32 constexpr float factor =
33 ((1.0) /
34 (static_cast<double>(std::numeric_limits<int>::max()) + (1.0)));
35 constexpr float half_factor = ((0.5f) * factor);
36
37 return sycl::fma(static_cast<float>(num), factor, half_factor);
38}
39
40// Generates rationals in (0, 1]
41static double getDouble01(uint num1, uint num2) {

Callers 2

Calls 2

fmaFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected