Overflow and Underflow

Overflow is said to occur when the number that one gets as a result of some arithmetic operation on two n-bit binary numbers (signed or unsigned) is larger in magnitude than the largest number one can represent using n-bits. What if the operation of two numbers yields a number which is smaller than the smallest representable number? Is this underflow? Note that this may still be called an overflow since, we are only concerned with the magnitude. Hence the example I was trying to construct in class today which was of the second type, is actually an overflow.

Since we are only concerned with magnitude, why even talk about underflow? Talking about underflow makes sense for floating-point numbers. For example using a 4-bit 2's complement representation for an exponent of a floating-point number, would enable us to represent numbers of the order of 10-16 to 1015. If the number is less than 10-16 there would be no way to represent it, and hence it would lead to an underflow. Underflow in floating-point arithmetic may also be thought of as overflow of the exponent.

这下总算明白了。。

转载于:https://www.cnblogs.com/zcold/archive/2011/02/18/1958239.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值