The n?bit two’s complement integer N is written an?1, an?2, . . . a1, a0. Prove that (in two's complement notation) the representation of a signed binary number in n + 1 bits may be derived from its representation in n bits by repeating the leftmost bit. For example, if n = ?12 = 10100 in five bits, n = ?12 = 110100 in six bits.

What will be an ideal response?


In n bits the positive number N is represented by an?1, an?2, . . . a 1, a0. We can extend this to n+1 bits by appending a 0 to the left without changing its value; that is 0, an?1, an?2, . . . a 1, a0.

Now consider the value ?N in n bits. This is represented as 2n ? N. If we extend this to n + 1 bits, it becomes 2n+1 ? N or 2n + 2n ? N. This is, of course, the original negative representation with a leading 1 to the left. Consequently, a positive number is extended by appending a 0, and a negative number by adding a 1; that is, by extending the sign bit.

Computer Science & Information Technology

You might also like to view...

Write a prototype and prototype comments for the sqrt library function.

What will be an ideal response?

Computer Science & Information Technology

Which of the following statements are correct?

a. new Scene(new Button("OK")); b. new Scene(new Circle()); c. new Scene(new ImageView()); d. new Scene(new Pane());

Computer Science & Information Technology

Match the following terms to their meanings:

I. Folder holds messages that you have not yet completed A. Shared folder II. Folder that can be accessed by more than one person B. Drafts folder III. Multiple lists of folders with varying message types C. newsgroup IV. Preview pane displays a single e-mail from this location D. Folders list V. Public meeting place for open discussion E. message list

Computer Science & Information Technology

A journal is used in manual accounting environments. What file is comparable to a journal in a computerized environment?

A. archive file B. reference file C. transaction file D. master file

Computer Science & Information Technology