|
|
@ -1,24 +0,0 @@ |
|
|
|
--- a/src/pdfs.c
|
|
|
|
+++ b/src/pdfs.c
|
|
|
|
@@ -80,7 +80,7 @@ float box_muller(void) {
|
|
|
|
fprintf(stderr, "pdf box_muller() rand() error\n"); |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
- w = sqrt( (-2.0 * log( w ) ) / w );
|
|
|
|
+ w = sqrt( (-2.0 * logf( w ) ) / w );
|
|
|
|
y1 = x1 * w; |
|
|
|
y2 = x2 * w; |
|
|
|
} |
|
|
|
@@ -93,8 +93,8 @@ float normal(float mean, float variance)
|
|
|
|
} |
|
|
|
|
|
|
|
float lognormal(float mu, float sigma) { |
|
|
|
- float phi = sqrt((mu * mu) + (sigma * sigma));
|
|
|
|
- float mu_prime = log(((mu * mu)/phi));
|
|
|
|
- float sigma_prime = sqrt(log((phi * phi)/(mu * mu)));
|
|
|
|
- return (exp(normal(mu_prime,sigma_prime)));
|
|
|
|
+ float phi = sqrtf((mu * mu) + (sigma * sigma));
|
|
|
|
+ float mu_prime = logf(((mu * mu)/phi));
|
|
|
|
+ float sigma_prime = sqrtf(logf((phi * phi)/(mu * mu)));
|
|
|
|
+ return (expf(normal(mu_prime,sigma_prime)));
|
|
|
|
} |