Math might be ok and code could be handy, but in reality RSSI (Received signal strength indicator) and Noise floor (NF) are negative Power values and normally does not fall below -90 dBm
And quality of the signal is normally the SNR value which is the signal to Noise Ratio and is calculated as follows:
SNR = RSSI - NF
E.g. we have:
RSSI = -55 dBm
NF = -89 dBm
SNR = -55 - -89 = 89 - 55 = 34 dB, which is pretty good for Video and/or VoIP
Now imagine we have RSSI = -80 dBm at the same NF level it would give us only 9 dB of SNR which is really bad, slow and breaking connection, not good enough for even browsing.