|
|
| Line 1: |
Line 1: |
| '''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.
| | Hello. Allow me introduce the writer. Her title is std testing at home Emilia Shroyer but it's not the most female title out there. Since she was 18 she's been operating as a receptionist but her marketing by no means arrives. Body building is over the counter std test what my family and [http://Drrachael.com/adult/?p=425 I enjoy]. South Dakota is exactly where me and my spouse live and my family loves it.<br><br>Visit my webpage - at home std test ([http://pagepapers.com/index.php?do=/profile-4850/info/ just click the following document]) |
| | |
| For example, if the valid range of values is from -100 to 100, the following operations produce the following values:
| |
| * 60 + 43 = 100
| |
| * (60 + 43) − 150 = −50
| |
| * 43 − 150 = −100
| |
| * 60 + (43 − 150) = −40
| |
| * 10 × 11 = 100
| |
| * 99 × 99 = 100
| |
| * 30 × (5 − 1) = 100
| |
| * 30 × 5 − 30 × 1 = 70
| |
| As can be seen from these examples, familiar properties like [[associativity]] and [[distributivity]] fail in saturation arithmetic. This makes it unpleasant to deal with in abstract mathematics, but it has an important role to play in [[digital hardware]] and algorithms.
| |
| | |
| Typically, general-purpose [[microprocessor]]s do not implement integer arithmetic operations using saturation arithmetic; instead, they use the easier-to-implement [[modular arithmetic]], in which values exceeding the maximum value "[[Integer overflow|wrap around]]" to the minimum value, like the hours on a clock passing from 12 to 1. In hardware, modular arithmetic with a minimum of zero and a maximum of 2<sup>''n''</sup>-1 can be implemented by simply discarding all but the lowest ''n'' bits.
| |
| | |
| However, although more difficult to implement, saturation arithmetic has numerous practical advantages. The result is as numerically close to the true answer as possible; it's considerably less surprising to get an answer of 127 instead of 130 than to get an answer of −126 instead of 130. It also enables overflow of additions and multiplications to be detected consistently without an overflow bit or excessive computation by simple comparison with the maximum or minimum value (provided the datum is not permitted to take on these values).
| |
| | |
| Additionally, saturation arithmetic enables efficient algorithms for many problems, particularly in [[digital signal processing]]. For example, adjusting the volume level of a sound signal can result in overflow, and saturation causes significantly less distortion to the sound than wrap-around. In the words of researchers G. A. Constantinides et al.:
| |
| | |
| {{quote|When adding two numbers using two’s complement representation, overflow results in a ‘wrap-around’ phenomenon. The result can be a catastrophic loss in signal-to-noise ratio in a DSP system. Signals in DSP designs are therefore usually either scaled appropriately to avoid overflow for all but the most extreme input vectors, or produced using saturation arithmetic components.<ref>G. A. Constantinides, P. Y. K. Cheung, and W. Luk. ''[http://portal.acm.org/citation.cfm?id=785411.785415 Synthesis of Saturation Arithmetic Architectures]''</ref>}}
| |
| | |
| Saturation arithmetic operations are available on many modern platforms, and in particular was one of the extensions made by the Intel [[MMX (instruction set)|MMX]] platform, specifically for such signal processing applications. This functionality is also available in wider versions in the SSE2 and AVX2 integer instruction sets.
| |
| | |
| Saturation arithmetic for integers has also been implemented in software for a number of programming languages including [[C (programming language)|C]], [[C++]], [[Eiffel (programming language)|Eiffel]]. This helps programmers anticipate and understand the effects of overflow better. On the other hand, saturation is challenging to implement efficiently in software on a machine with only modular arithmetic operations, since simple implementations require branches that create huge pipeline delays.
| |
| | |
| Although saturation arithmetic is less popular for integer arithmetic in hardware, the [[IEEE floating-point standard]], the most popular abstraction for dealing with approximate real numbers, uses a form of saturation in which overflow is converted into "infinity" or "negative infinity", and any other operation on this result continues to produce the same value. This has the advantage over simple saturation that later operations which decrease the value will not end up producing a "reasonable" result, such as in the computation <math>\sqrt{x^2-y^2}</math>.
| |
| | |
| ==Notes==
| |
| <!--<nowiki>
| |
| See http://en.wikipedia.org/wiki/Wikipedia:Footnotes for an explanation of how
| |
| to generate footnotes using the <ref> and </ref> tags, and the template below
| |
| </nowiki>-->
| |
| {{reflist}}
| |
| | |
| == External links ==
| |
| * [http://compilers.iecc.com/comparch/article/00-02-022 SARITH: Safe ARITHmetic – A Progress Report]: Report on a saturation arithmetic component for [[Eiffel (programming language)|Eiffel]].
| |
| | |
| [[Category:Computer arithmetic]]
| |
Hello. Allow me introduce the writer. Her title is std testing at home Emilia Shroyer but it's not the most female title out there. Since she was 18 she's been operating as a receptionist but her marketing by no means arrives. Body building is over the counter std test what my family and I enjoy. South Dakota is exactly where me and my spouse live and my family loves it.
Visit my webpage - at home std test (just click the following document)