I needed this today; maybe it will help someone else.

humidity should be 0-100 temp_c is a float

l = Math.log(humidity / 100.0)
m = 17.27 * temp_c 
n = 237.3 + temp_c 
b = (l + (m / n)) / 17.27
dewpoint_c = (237.3 * b) / (1 - b)