Integer overflow: Difference between revisions

Content deleted Content added
Acb146 (talk | contribs)
Added a section on Definition Variations and Ambiguity
Acb146 (talk | contribs)
Line 46:
then this event is commonly defined as a saturation.
Usage varies as to whether a saturation is or is not an overflow.
To eliminate ambiguity, the terms wrap onwrapping overflow <ref>https://www.mathworks.com/help/simulink/gui/wrap-on-overflow.html?searchHighlight=overflow&s_tid=doc_srchtitle</ref>
and saturate onsaturating overflow<ref>https://www.mathworks.com/help/simulink/gui/saturate-on-overflow.html?searchHighlight=overflow&s_tid=doc_srchtitle</ref>
can be used.
 
Line 72:
<ref>[https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%209899:2011&msclkid=2f0af3a2b5ca143c9285a9f8e8f6b3e1&utm_source=bing&utm_medium=cpc&utm_campaign=Campaign%20%231&utm_term=ISO%2FIEC%209899%3A2011&utm_content=iso-iec ISO C11 Standard]</ref>
defines that conversions from floating point to integer must round toward zero.
If C is used to convert the floating point value 127.25 to integer, then rounding should be applied first to givengive an ideal integer output of 127.
Since the rounded integer is in the outputs range, the C standard would not classify this conversion as an overflow.
 
 
==Methods to mitigate integer overflow problems==