summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/gauss2.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-03-28 19:32:28 +0200
committerTyge Løvset <[email protected]>2023-03-28 19:32:28 +0200
commit4f0ca428e332761666916477b22c3301044a85c6 (patch)
tree11ab09d983d54bf6a624b29b0cbd1cd9df80286d /misc/examples/gauss2.c
parent59d74d181e44dd05a8570b42fc6284745e225664 (diff)
downloadSTC-modified-4f0ca428e332761666916477b22c3301044a85c6.tar.gz
STC-modified-4f0ca428e332761666916477b22c3301044a85c6.zip
Fix gauss2.c
Diffstat (limited to 'misc/examples/gauss2.c')
-rw-r--r--misc/examples/gauss2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/examples/gauss2.c b/misc/examples/gauss2.c
index ce29f786..7fede5aa 100644
--- a/misc/examples/gauss2.c
+++ b/misc/examples/gauss2.c
@@ -14,7 +14,7 @@ int main()
enum {N = 5000000};
uint64_t seed = (uint64_t)time(NULL);
stc64_t rng = stc64_new(seed);
- const float Mean = round(stc64_randf(&rng)*98.f - 49.f), StdDev = stc64_randf(&rng)*10.f + 1.f, Scale = 74.f;
+ const double Mean = round(stc64_randf(&rng)*98.f - 49.f), StdDev = stc64_randf(&rng)*10.f + 1.f, Scale = 74.f;
printf("Demo of gaussian / normal distribution of %d random samples\n", N);
printf("Mean %f, StdDev %f\n", Mean, StdDev);
@@ -33,7 +33,7 @@ int main()
// Print the gaussian bar chart
c_forpair (index, count, csmap_int, hist) {
- int n = (int)round((float)*_.count * StdDev * Scale * 2.5f / (float)N);
+ int n = (int)round((double)*_.count * StdDev * Scale * 2.5 / (double)N);
if (n > 0) {
cstr_resize(&bar, n, '*');
printf("%4d %s\n", *_.index, cstr_str(&bar));