Due Monday, February 14, 2011.
/* Determine whether arguments can be subtracted without overflow */ int tsub_ok (int x, int y);This function should return 1 if the computation x - y does not overflow, 0 otherwise.
We generate arbitrary values x and y, and convert them to unsigned values as follows:
/* Create some arbitrary values */ int x = random(); int y = random(); /* Convert to unsigned */ unsigned ux = (unsigned) x; unsigned uy = (unsigned) y;
For each of the following C expressions, you are to indicate whether or not the expression always yields 1. If it always yields 1, describe the underlying mathematical principles. Otherwise, give an example of arguments that make it yield 0.
When the problems call for C code, make sure the code you write actually compiles and runs correctly on an x86 Linux system such as the main computers.
Write up the answers to these homework problems using a word processor or typesetting program and email a PDF to your teaching assistant as an attachment by 11:59pm, Monday, February 14, 2011. You may draw your K-map by hand and scan it in, or you may (preferably) use a computerized drawing program. All other work must be word-processed. Make sure to email only one PDF file containing everything you intend to turn in. You may not work together on this assignment. Late assignments will not be accepted.