Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guard, round, sticky bits (floating point)

I don't understand what is the meaning of guard, round and sticky bits. I have an example: if we add 3.25+30 (3 bit mantissa) we get 32 because grs=011. I was trying to solve it but all I have managed to do is this: 30=1.111*2^4 3.25=0.001101*2^4 and if I add up the numbers the result is 1.0000101*2^5, which means g=0 r=1 s=1. The problem is now that I can't figure out why is the correct answer 32.

like image 451
Mirjan Pecenko Avatar asked Sep 01 '25 05:09

Mirjan Pecenko


1 Answers

Guard, round, and sticky bits of 0, 1, 1 tell you that the “residue bits” (by which I mean the bits starting just below the point where we are going to round) are .01xxx…, where xxx… is not known but contains at least one 1 bit. Thus, the “residue” portion is more than ¼ ULP (is .01 plus something positive) but less than ½ ULP (is less than .100…).

If you are rounding to nearest, you would round down, since the “residue” portion is less than ½ ULP.

like image 184
Eric Postpischil Avatar answered Sep 05 '25 07:09

Eric Postpischil