C Numeric Formats
C – 6
can grow by these two bits (two orders of magnitude) before overflowing;
thus, these bits are called
guard
bits. If it is known that a process will not
cause any value to grow by more than these two bits, then the process can
be run without loss of data. Afterward, however, the block must be
adjusted to replace the guard bits before the next process.
Figure C.5 shows the data after processing but before adjustment. The
block floating-point adjustment is performed as follows. Initially, the
value of SB is –2, corresponding to the 2 guard bits. During processing,
each resulting data value is inspected by the EXPADJ instruction, which
counts the number of redundant sign bits and adjusts SB is if the number
of redundant sign bits is less than 2. In this example, SB=–1 after
processing, indicating that the block of data must be shifted right one bit
to maintain the 2 guard bits. If SB were 0 after processing, the block would
have to be shifted two bits right. In either case, the block exponent is
updated to reflect the shift.
0x1FFF
0x3FFF
0x07FF
=
=
=
0001
0011
0000
1111
1111
0111
1111
1111
1111
1111
1111
1111
1 Guard Bit
Sign Bit
EXPADJ instruction checks
exponent, adjusts SB
Exponent = –2
Exponent = –1
Exponent = –4
SB = –2
SB = –1
SB = –1
0x0FFF
0x1FFF
0x03FF
=
=
=
0000
0001
0000
1111
1111
0011
1111
1111
1111
1111
1111
1111
2 Guard Bits
Sign Bit
1. Check for Bit Growth
2. Shift Right to Restore Guard Bits
Figure C.5 Block Floating-Point Adjustment