using intmax_t rather than native integer type for boundaries