Revisiting Overflow in Integer Multiplication
Abstract
Integer multiplication is a very common operation that is executed in many applications. However, some of these applications suffer from the overflow problem caused by the multiply operation of two operands. The overflow occurs whenever the multiplication of any two-integer numbers exceeds the maximum limit available for the result. Many programming languages ignored this problem; therefore, the programmer has to handle it, mostly in “predict and avoid” approach. Present study addresses the detection and control of integer overflow in programming languages. Two examples from C and JAVA programming languages are considered. The paper suggests “detect and do” algorithms to handle the overflow. In addition, this paper suggests adding a built-in function to test whether an overflow will be generated by multiplication operation in advance.
DOI: https://doi.org/10.3844/jcssp.2005.304.309
Copyright: © 2005 Eyas El-Qawasmeh and Ahmed Dalalah. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
- 3,118 Views
- 2,890 Downloads
- 0 Citations
Download
Keywords
- BigInteger
- Detection
- Multiplication
- Overflow