Topic summary

Range check

Range check

Extracted from the Wikipedia article Bounds checking.

Range checking

A range check confirms that a number is within a viable range for the program's functioning, such as ensuring that a value about to be assigned to a 16-bit integer is within the capacity of a 16-bit integer (i.e. checking against wrap-around). This is slightly different from type checking, which confirms that the data type is appropriate for the program's type system. Other range checks may be more restrictive; for example, a variable to hold the number of a calendar month may be declared to accept only the range 1 to 12.