Research Article Open Access

Revisiting Overflow in Integer Multiplication

Eyas El-Qawasmeh1 and Ahmed Dalalah1
  • 1 ,
Journal of Computer Science
Volume 1 No. 3, 2005, 304-309

DOI: https://doi.org/10.3844/jcssp.2005.304.309

Submitted On: 8 February 2005 Published On: 30 September 2005

How to Cite: El-Qawasmeh, E. & Dalalah, A. (2005). Revisiting Overflow in Integer Multiplication. Journal of Computer Science, 1(3), 304-309. https://doi.org/10.3844/jcssp.2005.304.309

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.

  • 1,069 Views
  • 1,672 Downloads
  • 0 Citations

Download

Keywords

  • BigInteger
  • Detection
  • Multiplication
  • Overflow