浮点运算 计机组成原理.ppt

  1. 1、本文档共38页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
浮点运算 计机组成原理

* * 计算机组成原理 Principles of Computer Organization 广义双语教学课程 09/skyclass25/ 青岛理工大学 校级精品课程 /ec/C84/ 第3章 运算方法和运算部件 ( 5 ) Floating-point computation in a computer can run into three kinds of problems: An operation can be mathematically illegal, such as division by zero. An operation can be legal in principle, but not supported by the specific format, for example, calculating the square root of ?1 or the inverse sine of 2 (both of which result in complex numbers). An operation can be legal in principle, but the result can be impossible to represent in the specified format, because the exponent is too large or too small to encode in the exponent field. Such an event is called an overflow (exponent too large) or underflow (exponent too small). §3.5 浮点数的运算方法 Floating-Point Arithmetic 浮点加减法运算 浮点乘法运算 Floating-Point Multiplication Floating-Point Addition Subtraction 浮点除法运算 Floating-Point Division 浮点运算 Floating-Point Arithmetic 浮点运算要把阶码和尾数分别处理。 阶码的运算是定点整数运算,对阶码的运算有四种:阶码加1,阶码减1,两阶码求和,两阶码求差。 尾数的运算是定点小数运算。 运算过程中一般取双符号位。 浮点运算器总是由处理阶码和处理尾数的两部分组成。 Floating-point representation is similar in concept to scientific notation. The way in which the significand, exponent and sign bits are internally stored on a computer is implementation-dependent. 浮点数的溢出 Overflow 当一个数的大小超出了浮点数的表示范围时,机器无法表示该数,就发生溢出。浮点数的溢出判断方法与定点数不同,是对规格化数的阶码Exponent进行判断。 当浮点数的阶码大于机器所能表示的最大阶码时(即阶码发生正溢出),称为溢出(Overflow)或上溢,此时机器应停止运算,进行出错中断处理。 当浮点数的阶码小于机器所能表示的最小阶码时(即阶码发生负溢出),称为下溢(Underflow)。这时一般规定把该浮点数的尾数强迫置零,作为零处理,机器可继续运行。 当一个浮点数的尾数为0,不论其阶码为何值,或者阶码的值小于等于它能表示的最小数值(下溢)时,不论其尾数为何值,计算机都把该浮点数看成零值,称为机器零。 浮点数的尾数运算的溢出可以通过右规消除。 不算溢出 浮点加减法运算Floating-Point Addition Subtraction 设有两个规格化浮点数 X=MX·2Ex , Y=MY·2Ey 若两数的阶码相等,即 EX=EY,有 X+Y = 将两浮点数的尾数相加,就可得到浮点形式的和。 一般情况下,EX≠EY,计算X+Y要用如下五个步骤来完成: ① 对阶 ② 尾数相加 ③ 规格化 ④ 舍入 ⑤ 检查阶码是否溢出。 1、浮点加法运算 Floating-Point Addition MX ·2Ex + MY ·2Ey =(MX + MY )·2Ex (1) 对阶 Alignment 两数相加,必须使小数点对齐。对于浮点数来说,就是使阶码相等。使阶码相等的过程称为对阶。 对阶的原则是:小的阶码向大阶码看齐。

文档评论(0)

ldj215323 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档