commit 774d54ed817d1bdc32028a9e4ca1cab5a458ee4d
parent df2a563e395da972737285319130567f92eb5002
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Sat, 24 Feb 2024 23:33:09 -0300
very small division tweaks
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ROADMAP.md b/ROADMAP.md
@@ -8,6 +8,7 @@
- [x] Give examples of new functions
- [x] Reference commit with cdf functions, even though deleted
- [ ] Post on suckless subreddit
+- [ ] Look into <https://lite.duckduckgo.com/html/> instead?
- [ ] Drive in a few more real-life applications
- [ ] US election modelling?
- [ ] Look into using size_t instead of int for sample numbers
diff --git a/squiggle.c b/squiggle.c
@@ -50,7 +50,7 @@ double sample_unit_normal(uint64_t* seed)
// // See: <https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform>
double u1 = sample_unit_uniform(seed);
double u2 = sample_unit_uniform(seed);
- double z = sqrt(-2.0 * log(u1)) * sin(2 * PI * u2);
+ double z = sqrt(-2.0 * log(u1)) * sin(2.0 * PI * u2);
return z;
}
@@ -90,7 +90,7 @@ double sample_normal_from_90_ci(double low, double high, uint64_t* seed)
// 5. If we want a 90% confidence interval from high to low,
// we can set mean = (high + low)/2; the midpoint, and L = high-low,
// Normal([high + low]/2, [high - low]/(2 * 1.6448536269514722))
- double mean = (high + low) / 2.0;
+ double mean = (high + low) * 0.5;
double std = (high - low) / (2.0 * NORMAL90CONFIDENCE);
return sample_normal(mean, std, seed);
}