ProgrammerHumor

compareFloatsBeforeYouRound

compareFloatsBeforeYouRound
https://i.redd.it/exx601zlimef1.png
Reddit

Discussion

klaasvanschelven

Nevermind rounding... I feel this warning wouldn't be much better if it marked 73 > 72 as a HigH tEmPARaTURE aLERT!1!!

9 hours ago
AwesomePerson70
:js:

I assume it’s intended to alert if it stays above your set temp for a while and never reaches it. This wouldn’t be something that shows up every time your house is warm

7 hours ago
WiglyWorm
:ts::js::cs::py:

If my thermostat is set to 72 and my house is a pretty consistent 73, I really don't need a warning ever for that.

5 hours ago
Tupcek

if it is working on 100% all the time and still can’t reach 72, you do need that warning

4 hours ago
Adventurous_Bonus917

with this kind of fancy system, if it's running all the time and still has it one degree above for a long time, you need it to get checked out.

4 hours ago
Slavasonic

You might if it means your AC needs maintenance.

4 hours ago
TerryHarris408

and that at 3 AM 😵‍💫🫨

9 hours ago
dev_vvvvv

Wouldn't you still have the same issue if the threshold temperature is 72 and the actual temperature is 72.1? The rounding itself seems to be the problem.

9 hours ago
ZealousidealEgg5919

Not if you round before, which is what is suggested as I understood.

72.1 > 72

But

rounded(72.1) == rounded(72)

2 hours ago
kbn_

Actually this isn’t a floats issue, it’s a Celsius one. The actual temperature measured by the thermostat is almost certainly 22.5, while the desired temperature is almost certainly 22. Both could plausibly display as 72 when converted into Fahrenheit.

This type of bug is very common with smart thermostats. For a long time, the ecobee wouldn’t allow you to make small increment adjustments in certain Fahrenheit ranges because the values rounded to the same underlying Celsius temperature. This is now fixed but it’s still a persistent issue for Americans.

8 hours ago
vortex05

I have an ecobee 3 internally I think it's doing things in farenheit . When you go configure offsets in celsius one of your option is 0.8C and then 1.1C if it's celsius based I'd expect it to do 0.5C increments like my honeywell.

8 hours ago
redtrad

If you convert integer Celsius units to Fahrenheit and round, you miss several integer Fahrenheit values. One of them being 69 which is kind of funny. Since the value is 68, I'm guessing something similar is happening here. Two different Celsius values both converting to 68F

5 hours ago
k-mcm

Yep. The UX gets messed up if you toggle Celsius/Fahrenheit after programming it. I'm guessing it doesn't round off or truncate consistently. It can say it's set to cool at 78F but not be cooling when it shows 79F.

3 hours ago
Vibe_PV

As an European I got scared for a moment

5 hours ago
rover_G
:c::rust::ts::py::r::spring:

They didn’t set a high enough tolerance or didn’t use one at all

6 hours ago
Electrical-Echidna63

Ahh so this is that assertAlmostEqual is all about

2 hours ago
RiceBroad4552
:s:

That's a sauna, right? Because 72° C is pretty hot.

Or is this US people still not using global standards?

28 minutes ago
reallokiscarlet

This is why if you're gonna use celsius internally, at least round to the hundredth and not the whole degree.

Stupid IoT manufacturers gonna stupid IoT manufacture

4 hours ago
anonymity_is_bliss

Maybe if you used the SI system like 90% of other countries you wouldn't have localization errors

¯⁠\⁠_⁠༼⁠ ⁠•́⁠ ͜⁠ʖ⁠ ⁠•̀⁠ ⁠༽⁠_⁠/⁠¯

2 hours ago
reallokiscarlet

You mean Kelvin?

Jokes aside, thing is, even if you're using celsius on front and back end, you should NOT round to the whole C except maybe to display it if you hate yourself.

2 hours ago
TiedWith_Love

for those that dont see the error, it says "72, which is above your desired temperature of 72"

1 hour ago
manojguha

AI gave a very good explanation of why this happened without any internet usage.

What’s “wrong” here is that the thermostat is warning you that the house is “above” your set‐point, even though the big white number it shows is exactly 72°. In other words, it’s telling you “72 is greater than 72,” which obviously makes no sense at first glance.

What’s almost certainly happening is:

  1. Internal vs. displayed values The Ecobee’s temperature sensor reports a precise floating‑point reading (e.g. 72.3 °F), and its alert logic fires whenever that raw value exceeds your desired set‑point (72.0 °F). But on screen it rounds everything to the nearest whole number, so it shows “72” even though internally it saw something like 72.3, tripped the “high temp” rule, and popped an alert.
  2. Threshold configured at zero offset By default most thermostats won’t alert unless you’re a degree or two above your set‑point. If you’ve set your “high‑temp alert” threshold to zero, it will fire as soon as any tiny fluctuation above 72.0 registers — even if that fluctuation is just a few tenths of a degree.
  3. A minor UI/firmware bug Finally, it may simply be a logic bug in the firmware: the comparison is coded as “if (current ≥ desired) then alert” but the display code says “round(current) = X” and never shows you the fraction. The result is a confusing “72 isn’t greater than 72” message.

In short, nothing mystical has happened to your HVAC: it’s almost certainly an innocuous rounding/threshold issue (or a small firmware hiccup) that makes the alert read “above 72” even though the rounded display still reads 72.

6 hours ago
TheMaleGazer

Thank the AI for explaining the "72 isn’t greater than 72" message that we don't see.

6 hours ago
RiceBroad4552
:s:

Just that it's more likely it's a Celsius to Fahrenheit rounding error according to people who know this device.

But at least "AI" made up a nice story. It's really grate at that! 😂

If just not almost everything coming out of it be complete bullshit, it could be likely really helpful, I guess.

32 minutes ago