
40 GPGPU Programming for Games and Science
}
else
{
// x = signaling NaN
}
// payload = t & 0x003fffff
}
}
LISTING 2.8: Decoding a 32-bit floating-point number.
The maximum (unbiased) exponent is e
max
= 127. The minimum (unbi-
ased) exponent is e
min
=1− e
max
= −126. The relationship between the
minimum and maximum exponents is required by the IEEE 754-2008 Stan-
dard. The number of bits in the significand is p = 24, which includes the
twenty-three bits of the trailing significand and the leading 1-valued bit for
normal numbers. The subnormal numbers have a leading 0-valued bit, so the
number of significant bits for subnormals is always smaller than p.
The encoding ...