P&H 3.21


Oh come on, just look it up on the ASCII table.

P&H 4.14

  1. -1880113152
    Check the answer by using the following C program:
    	int main(int argc, char* argv[]) {
    	
    	  int n = 0x8FEFC000;
    	  printf("%d\n", n);
    
    	  return 0;
    	}
    
  2. 2414854144
    Check the answer by using the following C program:
    	int main(int argc, char* argv[]) {
    
    	  unsigned int n = 0x8FEFC000;
    	  printf("%u\n", n);
      
    	  return 0;
    	}
    
  3. -1.110111111*2-96, or -2.364*10-29
  4. lw $15, 49152($31)

P&H 4.15

  1. 0
  2. 0
  3. 0
  4. sll $0, $0, 0

P&H 4.25

10 decimal = 1010 binary
	   = 1.01 binary x 23
From this, we get:
Sign = 0
Significand = 0.010000000....
Single-Precision Exponent = 3 + 127 = 130
Double-Precision Exponent = 3 + 1023 = 1026

Putting this all together, we get:
Single-Precision: 0 10000010 01000000000000000000000
Double-Precision: 0 10000000010 0100000000000000000000000000000000000000000000000000

P&H 4.28

-2/3 = (-1/3)*21
     = (-001/011)*21 
     = -0.010101...*21
     = -1.01010101...*2-1
single precision: 1 01111110 01010101010101010101010
double precision: 1 01111111110 01010101010101010101
	  	  01010101010101010101010101010101

P&H 4.31

Assume that X is stored in $a0
mult_by_two:	lw $t0 0($a0)
		sll $t1 $t0 1	#Ready the exponent
		srl $t1 $t1 24
		addi $t1 $t1 1	#Add 1 to exponent
		sll $t1 $t1 23	#Return exponent to its original position
		andi $t0 $t0 0x807fffff	#Ready original number for insertion of new exponent
		or $t0 $t0 $t1	#Insert the new exponent
		sw $t0 0($a0)
1