6 * tally - running tally of integers
8 * The tally module implements simple analysis of a stream of integers.
9 * Numbers are fed in via tally_add(), and then the mean, median, mode and
10 * a histogram can be read out.
15 * #include <ccan/tally/tally.h>
17 * int main(int argc, char *argv[])
26 * errx(1, "Usage: %s <number>...\n", argv[0]);
29 * for (i = 1; i < argc; i++)
30 * tally_add(t, atol(argv[i]));
32 * printf("Mean = %zi\n", tally_mean(t));
33 * val = tally_approx_median(t, &err);
34 * printf("Median = %zi (+/- %zu)\n", val, err);
35 * val = tally_approx_mode(t, &err);
36 * printf("Mode = %zi (+/- %zu)\n", val, err);
37 * histogram = tally_histogram(t, 50, 10);
38 * printf("Histogram:\n%s", histogram);
43 * License: LGPL (v3 or any later version)
44 * Author: Rusty Russell <rusty@rustcorp.com.au>
46 int main(int argc, char *argv[])
51 if (strcmp(argv[1], "depends") == 0) {
52 printf("ccan/build_assert\n");
53 printf("ccan/likely\n");