Skip navigation

This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.

Here is my work for problem 2.18:

Assuming the expressions are evaluated on a 32-bit machine that uses two's
complement arithmetic, fill in the following table describing the effect
of casting and relational operations, in the style of Figure 2.13:


Expression                                  Type      Evaluation
------------------------------------------------------------------
-2147483647-1 == 2147483648U                unsigned    true
------------------------------------------------------------------
-2147483647-1 < -2147483647                 signed       true
------------------------------------------------------------------
(unsigned) (-2147483647-1) < -2147483647    unsigned     true
------------------------------------------------------------------
-2147483647-1 < 2147483647                  signed       true
------------------------------------------------------------------
(unsigned) (-2147483647-1) < 2147483647     unsigned     false

when two's complement negative is converted to unsigned its value
inreases + 2w, would be much larger than when second value is
converted to unsigned

------------------------------------------------------------------

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: