/* See {nmsim_check.h} */ /* Last edited on 2020-12-11 19:13:50 by jstolfi */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include void nmsim_check_int64_value(char *name, int64_t v, int64_t vmin, int64_t vmax) { if ((v < vmin) || (v > vmax)) { fprintf(stderr, "** value of %s = %ld", name, v); fprintf(stderr, " is out of range {%ld .. %ld}\n", vmin, vmax); demand(FALSE, "aborted"); } } void nmsim_check_double_value(char *name, double v, double vmin, double vmax) { if ((isnan(v)) || (v < vmin) || (v > vmax)) { fprintf(stderr, "** value of %s = %24.16e", name, v); fprintf(stderr, " is out of range [%24.16e .. %24.16e]\n", vmin, vmax); demand(FALSE, "aborted"); } }