You are assigned the task of writing code for a function tsub_ok, with arguments x and y,
Question:
You are assigned the task of writing code for a function tsub_ok, with arguments x and y, that will return 1 if computing x-y does not cause overflow. Having just written the code for Problem 2.30, you write the following:
For what values of x and y will this function give incorrect results? Writing a correct version of this function is left as an exercise (Problem 2.74).
Problem 2.30
Write a function with the following prototype:
This function should return 1 if arguments x and y can be added without causing overflow.
Problem 2.74
Write a function with the following prototype:
We can represent a bit pattern of length w = 4 with a single hex digit. For a two’scomplement
interpretation of these digits, fill in the following table to determine
the additive inverses of the digits shown:This function should return 1 if the computation x-y does not overflow.
Step by Step Answer:
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron