
CPU Computing 55
a 1-bit followed by the trailing significand bits and then followed by zero or
more 0-bits. Therefore, x is an integer and round
e
(x)=x.
Pseudocode for the rounding is presented next. The generic types
Integer
and UInteger represent signed and unsigned integers, respectively, with the
same number of bits as the binary encoding for the floating-point number.
Listing 2.17 is an implementation of the default rounding mode: rounding
with ties-to-even.
binaryN RoundToIntegralTiesToEven ( binaryN x )
{
UInteger sign , biased , t ra ili ng ;
GetEncoding(x , sign , biased , trail in g );
Integer exponent = biased − binaryN : :EXPONENT
BIAS ;
if (ex