0

Let's only consider single precision ieee-754 floating point numbers. I understand how to convert decimal floating-point number to its ieee-754 representation (Well... almost). My problem is with rounding step. I've heard about guard, rounding, and sticky bits (a.k.a. GRS). I also found following explanation:

If the least significant bit is followed by a 0, then the number is nearer to the representable number whose absolute value is smaller. If the least significant bit is followed by an 1 and then there is another 1 in any position, the number is nearer to the number whose absolute value is greater. If the bit after the least significant bit is an 1 and there is not another 1 in any position afterwards, then the number is exactly between 2 representable numbers, and then the number is rounded so that there is a 0 in the least significant bit afterwards.

By my understanding there exist three scenarios:

  1. G = 0 -> Truncation provides better approximation
  2. G = 1 & S = 0 -> Truncation and rounding up provide same approximation
  3. G = 1 & S = 1 -> Rounding up provides better approximation

So why is rounding bit implemented while guard and sticky bits could be enough?

0 Answers0