Theory of physiological adaptation of poikilotherms to heat and cold