Question

In: Computer Science

Discussion Topic: In a program written in a high level language, if an arithmetic error occurs...

Discussion Topic: In a program written in a high level language, if an arithmetic error occurs the program aborts and produces an error message that usually has the phrase "Arithmetic Overflow Error". This can happen in different circumstances such as: an illegal calculation was performed, such as trying to divide a number by zero the result of a calculation is a number that is too large or two small for the computer to store and in other circumstances as well. Which ALU flag do you think is responsible for indicating that an arithmetic overflow has occurred? Briefly state the ALU flag you think is responsible and briefly state your reasoning for believing that flag indicates when a high level program had an arithmetic overflow error.

Solutions

Expert Solution

Solution:

Arithmetic overflow errors are the errors that are occured when we perform any arithmetic operations like addition, subtraction, multiplication, division, bitwise operations. One of the good examples is dividing number by zero

Overflow generally means if the bits exceeded the allocated space. Generally the overflow can be a carry bit.

ALU generally by its name Arithmetic and Logical Unit takes care of all the arithmetic and logical operations that are performed in the program.

ALU has two types of flags. Carry Flag and Overflow flag.

The overflow flag is used for signed numbers and carry flag is used for unsigned numbers.

ALU does not care whether it is performing math on signed or unsigned numbers. It simply uses flags to determine the signed or unsigned numbers. So there is a sign flag.

So we cannot tell whether it is carry flag or overflow flag that causes Arithmetic overflow error. For signed numbers, the overflow flag is on which is repsonsible for the error.

For unsigned numbers, the carry flag is on which is repsonsible for the error.


Related Solutions

Let's assume that, an application program calls a High Level Language library function to display a...
Let's assume that, an application program calls a High Level Language library function to display a string with red color in the monitor. Explain the steps executing the operation (from function call to low hardware level).
The following program will be written in JAVA. Create a class called complex performing arithmetic with...
The following program will be written in JAVA. Create a class called complex performing arithmetic with complex numbers. Write a program to test your class.                         Complex numbers have the form:                         realPart + imaginaryPart * i                                               ___                         Where i is sqrt(-1)                                                 Use double variables to represent data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in...
This program should be written in Java language. Given the uncertainty surrounding the outbreak of the...
This program should be written in Java language. Given the uncertainty surrounding the outbreak of the Coronavirus disease (COVID-19) pandemic, our federal government has to work tirelessly to ensure the distribution of needed resources such as medical essentials, water, food supply among the states, townships, and counties in the time of crisis. You are a software engineer from the Right Resource, a company that delivers logistic solutions to local and state entities (schools, institutions, government offices, etc). You are working...
This program is to be written in Java Language. Thank you A College has conducted a...
This program is to be written in Java Language. Thank you A College has conducted a student survey. Students were asked to rate their satisfaction with remote learning courses. Students rated their satisfaction on a scale of 1 to 5 (1 = "I hate it", 5 = "I love it"). The student responses have been recorded in a file called "StudentResponses.txt". Each line of the file contains one student response. Program 1 You are to write a program that reads...
Interpreter and compiler are two methods to convert high level languages to machine language. How Python...
Interpreter and compiler are two methods to convert high level languages to machine language. How Python and C++ language works?
List the high-level benefits of programming languages and identify the particular language(s) which are most closely...
List the high-level benefits of programming languages and identify the particular language(s) which are most closely associated with each such specific benefit.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT