正在加载图片...
The last 4 bits are the fraction The representation encodes numbers of the form: V=(-1)s XMX2E, where M is the significand and E is the biased exponent The rules are like those in the IEEE standard(normalized, denormalized, representation of 0, infinity and NAN). FILL in the table below. Here are the instructions for each field Binary: The 8 bit binary representation M: The value of the significand. E: The integer value of the exponer Value: The numeric value represented Note: you need not fill in entries marked with Description Minus zero 0.0 01101101 Smallest denormalized(negative) Largest normalized(positive) 8.5 Problem 3:(0.5*24=12pts) Consider the following program struct s i double d float fi short union u t unsigned char buf [24]i struct s ai int 1 }u1 int main o int 1,] memset(&ul.a, 0, sizeof(struct s))i ul.as=0xbcde 0x12345678; / print out the bytes of ul buf as 2 digit hexidecimal numbers with a line break after every 8 bytes * for(i=0;i<3;i++) printf("0x\8. 2x ",ul buf [i*8+3]) Page 2 of 7-Page 2 of 7 ⚫ The last 4 bits are the fraction. ⚫ The representation encodes numbers of the form:V = (-1) s ×M×2 E , where M _ is the significand and E is the biased exponent. The rules are like those in the IEEE standard(normalized, denormalized, representation of 0, infinity, and NAN). FILL in the table below. Here are the instructions for each field: Binary: The 8 bit binary representation. M: The value of the significand. E: The integer value of the exponent. Value:The numeric value represented. Note: you need not fill in entries marked with ”—”. Description Binary M E V Minus zero -0.0 — 0 110 1101 Smallest denormalized (negative) Largest normalized (positive) — 8.5 Problem 3: (0.5*24=12pts) Consider the following program: struct s { char c; double d; float f; short s; }; union u { unsigned char buf[24]; struct s a; int i; } u1; int main() { int i,j; memset(&u1.a, 0, sizeof(struct s)); u1.a.c = 0xac; u1.a.d = -3.3; u1.a.f = 0x1; u1.a.s = 0xbcde; u1.i = 0x12345678; /* print out the bytes of u1.buf as 2 digit hexidecimal numbers with a line break after every 8 bytes */ for(i = 0; i < 3; i++) { for(j = 0; j < 8; j++) printf("0x\%.2x ",u1.buf[i*8+j]); printf("\n"); } }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有