"use strict"; function round2(x) { return Math.round(x * 100) / 100; } function windChillF(tempF, windMph) { const v016 = Math.pow(windMph, 0.16); return 35.74 + 0.6215 * tempF - 35.75 * v016 + 0.4275 * tempF * v016; } module.exports = { slug: "wind-chill-us-nws", title: "Wind chill (US NWS 2001 formula)", deck_category: "other", description: "Computes the wind chill temperature using the US National Weather Service's 2001 formula.", inputs: [ { name: "temp_f", type: "number", unit: "degrees F", required: true, description: "Air temperature.", max: 50 }, { name: "wind_mph", type: "number", unit: "mph", required: true, description: "Sustained wind speed.", min: 3 } ], outputs: [ { name: "wind_chill_f", unit: "degrees F", description: "Wind chill temperature." } ], steps: [ "NWS 2001 wind chill formula: WC = 35.74 + 0.6215*T - 35.75*V^0.16 + 0.4275*T*V^0.16, where T is air temperature in F and V is wind speed in mph.", "Valid range: temperature at or below 50 F and wind speed at or above 3 mph. Outside this range the formula is not meaningful.", "Round to the nearest whole degree." ], constants: [ { name: "wind_chill_valid_max_temp_f", value: 50, unit: "degrees F", source: 0 }, { name: "wind_chill_valid_min_wind_mph", value: 3, unit: "mph", source: 0 } ], sources: [ { kind: "url", value: "https://www.weather.gov/safety/cold-wind-chill-chart", title: "Wind Chill Chart and the 2001 NWS wind chill formula", publisher: "National Weather Service (NOAA)", retrieved_utc: "2026-09-30T19:52:00Z", note: "Official NWS wind chill formula adopted in 2001, valid for T<=50F and V>=3mph." } ], disclaimer: null, questionText(inputs) { return `Using the NWS 2001 formula, what is the wind chill at ${inputs.temp_f} degrees F with a ${inputs.wind_mph} mph wind?`; }, run(inputs) { const { temp_f, wind_mph } = inputs || {}; if (typeof temp_f !== "number" || temp_f > 50) throw new Error("temp_f must be a number at or below 50"); if (typeof wind_mph !== "number" || wind_mph < 3) throw new Error("wind_mph must be a number at or above 3"); const wc = Math.round(windChillF(temp_f, wind_mph)); return { answer: `${wc} degrees F`, values: { wind_chill_f: wc } }; }, examples: [ { name: "worked example", inputs: { temp_f: 5, wind_mph: 25 }, expected: { answer: "-17 degrees F" }, check: "By hand: 25^0.16 = e^(0.16*ln25) = e^0.51502 = 1.6737; WC = 35.74 + 3.1075 - 35.75*1.6737 + 0.4275*5*1.6737 = 38.8475 - 59.8348 + 3.5776 = -17.41, rounding to -17." }, { name: "test vector: milder cold", inputs: { temp_f: 30, wind_mph: 10 }, expected: { answer: "21 degrees F" }, check: "By hand: 10^0.16 = e^(0.16*ln10) = e^0.36841 = 1.4454; WC = 35.74 + 18.645 - 35.75*1.4454 + 0.4275*30*1.4454 = 54.385 - 51.673 + 18.537 = 21.25, rounding to 21." } ] };