$n should be 128, if that is 2**7. So, is that what your $n comes to?
Then $lon_deg should be 36/128*360 - 180 which would be -78.75 by my reckoning, if you assume the correct bracketing/precedence is (36/128)*360-180. And that looks pretty close to Jamaica...