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

Function getDoubleNegative11

src/backend/cpu/kernel/random_engine.hpp:171–178  ·  view source on GitHub ↗

Generates rationals in [-1, 1)

Source from the content-addressed store, hash-verified

169
170// Generates rationals in [-1, 1)
171double getDoubleNegative11(uint *val, uint index) {
172 intl v = transform<intl>(val, index);
173 // Conversion to doubles adapted from Random123
174 constexpr double signed_factor =
175 ((1.0l) / (std::numeric_limits<long long>::max() + (1.0l)));
176 constexpr double half_factor = ((0.5) * signed_factor);
177 return fma(v, signed_factor, half_factor);
178}
179
180#define MAX_RESET_CTR_VAL 64
181#define WRITE_STRIDE 256

Callers 1

boxMullerTransformFunction · 0.70

Calls 2

fmaFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected