
80 GPGPU Programming for Games and Science
{
// N e a r e s t i s NAR−zero .
return signNAR ;
}
if (nonnegWID <=WID
NAR MIN SUBNORMAL)
{
// N e a r e s t i s NAR−min−subnormal .
return signNAR | NAR
MIN SUBNORMAL ;
}
if (nonnegWID < WID
NAR MIN NORMAL)
{
// Round to ne a res t NAR−subnormal with ties −to−even . Note
// t h a t bi asedN AR i s i mp l i c i t ly z e r o .
trailingWID |=WID
SUP TRAILING MASK ;
rshift = WID
NUM TRAILING BITS − NAR NUM TRAIL ING BITS +
WID
EXPONENT BIAS − NAR EXPONENT BIAS + 1 − biasedWID ;
trailingNAR = ( trailingWID >> rshift );
lshift = WID
NUM ENCODING BITS − rshift ;
frcpart = (trailingWID << lshift );
if (frcpart > WID
HALF PROXY
||