4 ms·
These guys are clearly elite: <code> - (float)getHeatIndex:(float)temp:(float)humidity { NSLog(@"[getHeatIndex] temp: %f, humidity: %f", temp, humidity);
by feralchimp 15y ago
These guys are clearly elite:
<code>
- (float)getHeatIndex:(float)temp:(float)humidity {
NSLog(@"[getHeatIndex] temp: %f, humidity: %f", temp, humidity);
float hIndex =
-42.379 + 2.04901523 * temp
+ 10.14333127 * humidity
- 0.22475541 * temp * humidity
- 6.83783 * pow(10, -3) * temp * temp
- 5.481717 * pow(10, -2) * humidity * humidity
+ 1.22874 * pow(10, -3) * temp * temp * humidity
+ 8.5282 * pow(10, -4) * temp * humidity * humidity
- 1.99 * pow(10, -6) * temp * temp * humidity * humidity;
//hIndex = round(hIndex);
NSLog(@"-Heat Index: %f", hIndex);
return hIndex;
}
</code>
- jlev 15y agoSnark aside, that is the correct NWS formula for Heat Index given temperature in farenheight and percent humidity. Sure it's un ugly regression, but it's accurate within +- 1.3˚F http://www.srh.noaa.gov/images/ffc/pdf/ta_htindx.PDF http://www.srh.noaa.gov/images/ffc/pdf/ta_htindx.PDF via http://en.wikipedia.org/wiki/Heat_index http://en.wikipedia.org/wiki/Heat_index reference 8