From fe4bddc630820aeb8044dc8bc446974ab745177e Mon Sep 17 00:00:00 2001 From: Philipp Lutz Date: Sun, 2 Jun 2024 13:28:23 +0200 Subject: [PATCH] Use correct float version of expensive math operations --- DHT.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DHT.cpp b/DHT.cpp index adf69df..95e99c6 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -202,16 +202,16 @@ float DHT::computeHeatIndex(float temperature, float percentHumidity, if (hi > 79.F) { hi = -42.379F + 2.04901523F * temperature + 10.14333127F * percentHumidity + -0.22475541F * temperature * percentHumidity + - -0.00683783F * pow(temperature, 2.F) + - -0.05481717F * pow(percentHumidity, 2.F) + - 0.00122874F * pow(temperature, 2.F) * percentHumidity + - 0.00085282F * temperature * pow(percentHumidity, 2.F) + - -0.00000199F * pow(temperature, 2.F) * pow(percentHumidity, 2.F); + -0.00683783F * powf(temperature, 2.F) + + -0.05481717F * powf(percentHumidity, 2.F) + + 0.00122874F * powf(temperature, 2.F) * percentHumidity + + 0.00085282F * temperature * powf(percentHumidity, 2.F) + + -0.00000199F * powf(temperature, 2.F) * powf(percentHumidity, 2.F); if ((percentHumidity < 13.F) && (temperature >= 80.0F) && (temperature <= 112.0F)) hi -= ((13.0F - percentHumidity) * 0.25F) * - sqrt((17.0F - abs(temperature - 95.0F)) * 0.05882F); + sqrtf((17.0F - abs(temperature - 95.0F)) * 0.05882F); else if ((percentHumidity > 85.0F) && (temperature >= 80.0F) && (temperature <= 87.0F))