Skip to content

Commit

Permalink
Switch to this in Windchill Calculation to Avoid Rounding Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
leoherzog committed Jan 1, 2025
1 parent b31fd58 commit 12317c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ Number.prototype.mmToIn = function() { return this * 0.03937; }
Number.prototype.windChill = function(windSpeed, units='F') {
let T = units === 'F' ? this : this.cToF();
let W = units === 'F' ? windSpeed : windSpeed.kphToMPH();
if (T > 50 || W < 3) return units === 'F' ? T : T.fToC();
if (T > 50 || W < 3) return units === 'F' ? T : this;
let windChillF = 35.74 + 0.6215 * T - 35.75 * Math.pow(W, 0.16) + 0.4275 * T * Math.pow(W, 0.16);
return units === 'F' ? windChillF : windChillF.fToC();
}
Expand Down

0 comments on commit 12317c0

Please sign in to comment.