Saturation arithmetic

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:

  • 60 + 30 → 90.
  • 60 + 43 → 100. (not the expected 103.)
  • (60 + 43) − (75 + 25) → 0. (not the expected 3.) (100 − 100 → 0.)
  • 10 × 11 → 100. (not the expected 110.)
  • 99 × 99 → 100. (not the expected 9801.)
  • 30 × (5 − 1) → 100. (not the expected 120.) (30 × 4 → 100.)
  • (30 × 5) − (30 × 1) → 70. (not the expected 120. not the previous 100.) (100 − 30 → 70.)

Here is another example for saturating subtraction when the valid range is from 0 to 100 instead:

  • 30 - 60 → 0. (not the expected -30.)

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 values have maximum and minimum representable ranges.
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).


From Wikipedia, the free encyclopedia · View on Wikipedia

Developed by Tubidy