7 #include "subr_random.h"
22 probe_##type(struct stats *st, size_t N) \
28 memset(st, 0, sizeof(*st)); \
30 st->st_type = #type; \
32 for (i = 0; i < N; i++) { \
33 x = random_##type(1); \
34 switch (fpclassify(x)) { \
39 ++st->st_subnormals; \
51 /* invalid floating-point number */ \
58 typedef long double long_double;
64 print_stats(const struct stats *st)
68 printf("---------- %s ----------\n", st->st_type);
69 printf(" Normals: %u\n", st->st_normals);
70 printf("Subnormals: %u\n", st->st_subnormals);
71 printf(" NaNs: %u\n", st->st_nans);
72 printf(" Inf: %u\n", st->st_inf);
73 printf(" Zero: %u\n", st->st_zero);
74 printf(" Invalid: %u\n", st->st_invalid);
82 const size_t N = 100*1000*1000;
96 probe_long_double(&s, N);