Skip to content

Commit 2d963ff

Browse files
committed
Don't Calculate Heat Index when Temps are Cold
1 parent 6c95e02 commit 2d963ff

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

code.gs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ Number.prototype.windChill = function(windSpeed, units='F') {
13781378
// https://www.weather.gov/media/epz/wxcalc/heatIndex.pdf
13791379
Number.prototype.heatIndex = function(humidity, units='F') {
13801380
let T = units === 'F' ? this : this.cToF();
1381+
if (T < 80) return units === 'F' ? T : this;
13811382
let H = humidity;
13821383
let heatIndexF = -42.379 + 2.04901523 * T + 10.14333127 * H - 0.22475541 * T * H - 6.83783 * Math.pow(10, -3) * Math.pow(T, 2) - 5.481717 * Math.pow(10, -2) * Math.pow(H, 2) + 1.22874 * Math.pow(10, -3) * Math.pow(T, 2) * H + 8.5282 * Math.pow(10, -4) * T * Math.pow(H, 2) - 1.99 * Math.pow(10, -6) * Math.pow(T, 2) * Math.pow(H, 2);
13831384
return units === 'F' ? heatIndexF : heatIndexF.fToC();

0 commit comments

Comments
 (0)