MCPcopy Create free account
hub / github.com/numpy/numpy / standard_exponential_unlikely

Function standard_exponential_unlikely

numpy/random/src/distributions/distributions.c:46–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static double standard_exponential_unlikely(bitgen_t *bitgen_state,
47 uint8_t idx, double x) {
48 if (idx == 0) {
49 /* Switch to 1.0 - U to avoid log(0.0), see GH 13361 */
50 return ziggurat_exp_r - npy_log1p(-next_double(bitgen_state));
51 } else if ((fe_double[idx - 1] - fe_double[idx]) * next_double(bitgen_state) +
52 fe_double[idx] <
53 exp(-x)) {
54 return x;
55 } else {
56 return random_standard_exponential(bitgen_state);
57 }
58}
59
60double random_standard_exponential(bitgen_t *bitgen_state) {
61 uint64_t ri;

Callers 1

Calls 4

npy_log1pFunction · 0.85
next_doubleFunction · 0.85
expFunction · 0.85

Tested by

no test coverage detected