Saturation arithmetic is a version of arithmetic in which all operations, such as addition and multiplication, are limited to a fixed range between a minimum and maximum value.
If the result of an operation is greater than the maximum, it is set ("clamped") to the maximum; if it is below the minimum, it is clamped to the minimum. The name comes from how the value becomes "saturated" once it reaches the extreme values; further additions to a maximum or subtractions from a minimum will not change the result.
For example, if the valid range of values is from −100 to 100, the following saturating arithmetic operations produce the following values:
Here is another example for saturating subtraction when the valid range is from 0 to 100 instead:
As can be seen from these examples, familiar properties like associativity and distributivity may fail in saturation arithmetic.[a] This makes it unpleasant to deal with in abstract mathematics, but it has an important role to play in digital hardware and algorithms where only values ranging from a minimum to a maximum value can be represented.
Cite error: There are <ref group=lower-alpha>
tags or {{efn}}
templates on this page, but the references will not show without a {{reflist|group=lower-alpha}}
template or {{notelist}}
template (see the help page).
© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search