问题 问答题

已知X=0.0010011 Y=-0.0110110
(1)写出X和Y的浮点数格式,阶码用原码,尾数用补码(位数自选)
(2)用浮点数运算方法计算X+Y、X-Y(要求写出计算过程)

答案

参考答案:假设浮点数阶码4位,尾数8位,都包含符号位,阶码用原码,尾数用补码,则X和Y的浮点数分别为
[X]=1 010,0 1001100 [Y]=1 001,1 0010100
(1)求X+Y的过程如下:
①求阶差并对阶:
△E=Ex-Ey=1 001
即△E为-1,x的阶码小,应使x的尾数向右移1位,Ex加1
∴[X]=1 001,0 0100110(O0)
其中(0)表示右移1位后移出的最低一位数。
②尾数求和:
[*]
③规格化处理:
尾数运算结果的符号位为1,最高数值位为O,表示已符合尾数规格化要求。
④舍入处理:
采用0舍1入法处理,由于过程中移出的是0,所以结果不变。
⑤判溢出:
两异号数相加,不可能溢出。
故[X+Y]=1 001,1 0111010,即X+Y=-0.0100011
(2)求X-Y的过程如下:
①求阶差并对阶:
△E=Ex-Ey=1 001
即△E为-1,x的阶码小,应使x的尾数向右移1位,Ex加1
∴[X]浮=1 001,0 0100110(0)
其中(0)表示右移1位后移出的最低一位数。
②尾数求差:
[*]
③规格化处理:
尾数运算中,符号位有借位,而最高数值位没有借位,表明尾数溢出,即求和结果的绝对值大于1,需要将尾数右移实现规格化表示,结果为0.1001。01,阶码加1,为0000。
④舍入处理:
采用0舍1入法处理,由于过程中移出的都是0,所以结果不变。
⑤判溢出:
阶码没有溢出。
故[X-Y]=0 000,0 1001001,即X-Y=0.1001001

多项选择题
单项选择题

Unlike most sports, which evolved over time from street games, basketball was (31) by one man to suit a particular purpose. The man was Dr. James Naismith, and his purpose was to invent a (32) game that could be played indoors in the winter.

In 1891, Naismith was an instructor at a training school, which trained physical education instructors for the YMCAs. That year the school was trying (33) up with a physical activity that the men could enjoy (34) the football and baseball seasons. None of the standard indoor activities (35) their interest for long. Naismith was asked to solve the problem by the school.

He first tried to (36) some of the popular outdoor sports, but they were all too rough. The men were getting bruised from (37) each other and (38) hit with equipment. So, he decided to invent a game that would incorporate the most common elements of outdoor team sports without having the real physical (39) , Most popular sports used a ball, so he chose a soccer ball because it was soft and large enough that it (40) no equipment, such as a bat or a racket to hit it. Next he decided (41) an elevated goal, so that scoring would depend on skill and accuracy rather than on (42) only. His goals were two peach baskets, (43) to ten-foot-high balconies at each end of the gym. The basic (44) of the game was to throw the ball into the basket. Naismith wrote rules for the game, (45) of which, though with some small changes, are still (46) effect.

Basketball was a(n) (47) success. The students (48) it to their friends, and the new sport quickly (49) on. Today, basketball is one of the most popular games (50) the world.

(34)()

A. between

B. during

C. when

D. for