For MPGs, the hotter the better. Warm air is less dense so the ECU will adjust to dump less fuel, to keep the A:F ratio the same. In addition, at higher ambient temps your oil and transmission fluid start out thinner contributing to less drag. Plus (at least, in theory), the air you are driving through is less dense so there will be less drag. Of course, if you have your windows down or A/C on, that works against fuel mileage.
For HP, the colder the better. Cold air is more dense so the ECU adjusts to dump more fuel to keep the A:F ratio the same. The engine will in turn make more power. This is one reason you get worse fuel economy in the winter (the other reasons are: winter blend fuel, more idling to warm up engine, denser air creating more drag, added weight of ice/snow, thickened oil and transmission fluid before warm up creating more drag, etc.)