Please see the following example calculation using the values shown in the datasheet.
CURRENT _REF= 4.985A
CURRENT_MEAS= -5.001A
raw _ gain =Round{(abs(CURRENT _REF)/abs(CURRENT _MEAS))* 0b010000000000)
=Round{(abs(4.985)/abs(-5.001))* 0b010000000000)
=Round{0.9968* 0b010000000000)
=Round{1020.723)
=1021 or 0b001111111101 or
0x03FD (same value that the guide references)
nCGAIN.GAIN= last10 bit of (raw _ gain>> 2)+((raw _ gain & 2) >>1)
= last10 bit of (001111111101>> 2) + (( 001111111101& 2) >>1)
= last10 bit of (0011111111) + (( 0) >>1)
= last10 bit of (0011111111 + 0)
= 0011111111 or 0x00FF