
50 GPGPU Programming for Games and Science
{
// When trailing is MAX
TRAILING , x i s −MAX SUBNORMAL a nd
// n ex t−down i s −MIN
NORMAL.
++trailing ;
return SIGN
MASK | trailing ;
}
}
}
else if (biased < MAX
BIASED EXPONENT)
{
UInteger nonnegative = (x . encoding & NOT
SIGN MASK ) ;
if (sign == 0)
{
−− nonnegative ;
return nonnegative ;
}
else
{
++nonnegative ;
return SIGN
MASK | nonnegative ;
}
}
else if ( trailing == 0)
{
if (sign == 0)
{
// The n ex t−down o f +INFINITY i s +MAX
NORMAL.
return MAX
NORMAL;
}
else
{
// The n ex t−down of −INFINITY i s −INFINITY .
return SIGN
MASK | INFINITY ;
}
}
else if ( trailing & NAN
QUIET MASK )
{
// x is a quiet NaN; return it ( preserving its pay ...