AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
math.h
1#ifndef UTILS_MATH_H
2#define UTILS_MATH_H
3
4namespace utils {
5/* Test if the product of two numbers is bounded by a third number.
6 Safe against overflow. The caller must guarantee
7 0 <= factor1, factor2 <= limit; failing this is an error. */
8extern bool is_product_within_limit(int factor1, int factor2, int limit);
9
10/* Test if the product of two numbers falls between the given inclusive lower
11 and upper bounds. Safe against overflow. The caller must guarantee
12 lower_limit < 0 and upper_limit >= 0; failing this is an error. */
13extern bool is_product_within_limits(
14 int factor1, int factor2, int lower_limit, int upper_limit);
15}
16
17#endif