Soft'N'Design Software
/
projects
/
benchmarks.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
07e698c
)
fix histogram
author
Laurent Mazet
<mazet@softndesign.org>
Sun, 28 Sep 2025 11:29:53 +0000
(13:29 +0200)
committer
Laurent Mazet
<mazet@softndesign.org>
Sun, 28 Sep 2025 11:29:53 +0000
(13:29 +0200)
stat.c
patch
|
blob
|
blame
|
history
diff --git
a/stat.c
b/stat.c
index 4e5850ad08d27206c630027e3725c18ae3211e38..f28730efe3298eae3e86a8fc9417b6eb4f1192f9 100644
(file)
--- a/
stat.c
+++ b/
stat.c
@@
-84,7
+84,10
@@
void compute_statistics (int64_t *points, int nb, int bins)
double gap = (max - min) / bins;
for (int i = 0; i < nb - 1; i++) {
- hist[(int)((points[i] - min) * bins / (max -min))]++;
+ int j = (points[i] - min) * bins / (max -min);
+ if (j < 0) j = 0;
+ if (j >= bins) j = bins - 1;
+ hist[j]++;
}
hist[bins - 1]++;