P&H 3.21
P&H 4.14
int main(int argc, char* argv[]) { int n = 0x8FEFC000; printf("%d\n", n); return 0; }
int main(int argc, char* argv[]) { unsigned int n = 0x8FEFC000; printf("%u\n", n); return 0; }
P&H 4.15
P&H 4.25
10 decimal = 1010 binary = 1.01 binary x 23From this, we get:
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 $a0mult_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)