-12 dBm -(-20 dBm) = 8 dB. That is the gain.
Or in other words:
-20 dBm = 0.01 mW = 10 uW
-12 dBm = 0.0631 mW = 63.1 uW
then the ratio is (63.1/10)= 6.31 which in dB is
10 log(6.31) = 8 dB.....
Do not get confuse with negative number, remember
is only a reference.....dBm ----> mW.....any negative
number only means that is less than 1 mW....that is all.
-20dBm is less power than -12dBm.....think about it in
terms of a long scale with a 0 on it in some place.