Rounding Floating Point Numbers after addition (guard, sticky, and round bits)

≯℡__Kan透↙ 提交于 2019-12-05 05:18:51
user3534307

Single precision means the mantissa holds 23 bits (assuming 32 bit architecture), plus a hidden one. Therefore the first one disappears from the mantissa.

Next is to determine the G and R bits or Guard and Round bit.

The Guard bit is the first of two bits past the 0 bit of the mantissa that will be cutoff.

The round bit is the second bit after the o bit of the mantissa. The guard bit here is 1 and the round bit is zero since no other bit is present.

The sticky bit is also zero because there are no ones to the right of the round bit. Therefore we have GRS or 100.

Depending on the book or processor being used this normally means round to the nearest even number. In this case since the LSB (least significant bit) is 1 the number will be rounded up to 1100,0000,0000,0000,0000,010 for the mantissa.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!