diff options
author | Jaron <jaron@kent-dobias.com> | 2016-11-08 08:17:26 -0500 |
---|---|---|
committer | Jaron <jaron@kent-dobias.com> | 2016-11-08 08:17:26 -0500 |
commit | 0ad947f800bcbe2c488d2d5cbcdb16c46e6d3857 (patch) | |
tree | 225b77daf1eefbf38457696172b5b8cd6095b155 /src/rand.c | |
parent | baae7b05b59917df132fde049a56357a09d45caa (diff) | |
download | fuse_networks-0ad947f800bcbe2c488d2d5cbcdb16c46e6d3857.tar.gz fuse_networks-0ad947f800bcbe2c488d2d5cbcdb16c46e6d3857.tar.bz2 fuse_networks-0ad947f800bcbe2c488d2d5cbcdb16c46e6d3857.zip |
various changes, including adding central moments and changing the fuse thresholds to long doubles
Diffstat (limited to 'src/rand.c')
-rw-r--r-- | src/rand.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -9,12 +9,15 @@ unsigned long int rand_seed() { return seed; } -double rand_dist_pow(const gsl_rng *r, double beta) { - double x = 0; +long double rand_dist_pow(const gsl_rng *r, double beta) { + long double x = 0; // underflow means that for very small beta x is sometimes identically zero, // which causes problems - while ((x = exp(log(gsl_rng_uniform_pos(r)) / beta)) == 0.0); + while (x == 0.0) { + long double y = logl(gsl_rng_uniform_pos(r)) / beta; + x = expl(y); + } return x; } |