A sharp bound for the slope of double fibrations