double check ranges and don't blithely divide by zero