/* statistic module */
#include <assert.h>
-#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "stat.h"
-void compute_statistics (int64_t *points, int nb, int bins)
+#define STEP 20
+
+void compute_statistics (unsigned int *points, int nb, int bins)
{
printf ("Nb of points = %d\n", nb);
int change_done = 0;
for (int i = 1; i < nb - 1; i++) {
if (points[i + 1] < points[i]) {
- int64_t tmp = points[i];
+ unsigned int tmp = points[i];
points[i] = points[i + 1];
points[i + 1] = tmp;
change_done = 1;
printf ("Histogram (%d)\n", nb);
for (int i = 0; i < bins; i++) {
+ int h = (STEP * hist[i] + nb / 2 - 1) / nb;
+ for (int j = 0; j < STEP; j++) {
+ printf ("%c", (j < h) ? '#' : ' ');
+ }
printf (" [%.2lf - %.2lf] = %d\n", min + i * gap, min + (i + 1) * gap, hist[i]);
}