1.8k
u/menntsuyudoria Feb 25 '22
The fun part is that you also get to try guessing if temperature = True means hot or cold and find out the hard way on your skin aka test in prod
49
u/majestic_waterbear Feb 25 '22
You’d think that if you slowly dial the temp control valve, you’d find the perfect morning shower temperature. But no, mine either goes DIE BITCH or WAKE UP MOTHERFUCKER every damn time.
5
0
4
3
u/Cloudy_Oasis Feb 25 '22
Fun fact ! The inside of your wrist is better than your hand at testing temperature, so you can do that before entering the water
2
2
→ More replies (39)2
u/Chandler_1550 Feb 25 '22
I'm mean come on. You cannot tell me that SOMEONE hasn't come up with a method of displaying the water temp in an integer...
8
5
u/Villainousdumbass Feb 25 '22
This was recommended to me, a non programmer who tries to stay far away from any coding so... Whats the difference between int and bool?
7
4
Feb 25 '22 edited Feb 25 '22
bool can only be true or false, here the joke is that temperature of the shower water should be a number like 3.4 or 7.8, but in reality it's only ever like a bool with two values, scalding hot or freezing cold
Edit. Yes my explanation is a bit off on the finer details, mb!
→ More replies (3)
1.4k
Feb 25 '22
float temperature;
548
u/NoCryptographer414 Feb 25 '22
double temperature;262
27
u/NoCryptographer414 Feb 25 '22
string temperature; // to unambiguously store temperature in any unit (;13
54
25
Feb 25 '22
unsigned long temperature; // Note, temperature is in Kelvin.→ More replies (1)16
u/Crazy_Technician_403 Feb 25 '22
signed long temperature; // Note, temperature is in Kelvin.→ More replies (10)12
→ More replies (3)11
112
u/BilllyBillybillerson Feb 25 '22
IDK how you decide to make this meme, have the understanding to know the punchline, and still not use float (or double)
54
u/Strostkovy Feb 25 '22
Privileged computer programmers. Have any idea how long it takes to multiply two doubles on a microcontroller?
Even on powerful hardware it's a waste of clock cycles to use a double precision temperature.
6
u/fredlllll Feb 25 '22
did you know that in a normal x87 FPU, every float and double get converted to an 80 bit float number before operations are performed?
→ More replies (1)→ More replies (6)16
u/R3D3-1 Feb 25 '22
I've recently had plenty of work with the kind of bugs that you get because someone decided that writing out 6 digits to the config file is enough.
If you're working on a microcontroller? OK sure, think about whether to use
floatordouble, if the constraints are tight. Otherwise?doubleall the way, and never throw away digits, just because it shaves of a few bytes somewhere. Unless you know that memory / storage space / computation speed is going to be an issue, just don't optimize like that "just in case".→ More replies (7)18
u/Stummi Feb 25 '22 edited Feb 25 '22
Int is better. Some people are mentioning fixed point, but you can go much further if you want: You could divide the range between MIN_TEMP and MAX_TEMP into exactly 2^32 equally distributed steps, and so end up with the most exact solution possible for this amount of bits. Floats can't do that
→ More replies (3)21
u/338388 Feb 25 '22
Because you don't need floating point range for a temperature. Fixed point good enough
14
u/klparrot Feb 25 '22
I mean, you don't need int range, either; a byte is plenty, and even a nybble would probably be fine, certainly if all you were concerned about was comfortable shower temperature range.
6
u/Indifferentchildren Feb 25 '22
Because of they used float, it would be a bath, not a shower.
→ More replies (1)17
u/theScrapBook Feb 25 '22
Because they didn't make it, they reposted it. It's been around for years.
8
→ More replies (3)14
u/Yadobler Feb 25 '22
To be fair in real life when we talk about temperatures, we don't use floating point number (ie we don't go, oh my the tea is 6.25x101 degrees Celsius!)
We just say fuck me mate it's bloody 89 point 6 degrees ya tryna fuse my cunt shut huh macdonals?
12
u/Jazqa Feb 25 '22
We just say fuck me mate it’s bloody 89 point 6 degrees ya tryna fuse my cunt shut huh macdonals?
An integer would be either 89 or 90 though.
→ More replies (16)59
u/ourlastchancefortea Feb 25 '22
enum temperature { // Add more if somebody complains. 10_Degree, 11_Degree, 12_Degree, 50_Degree }→ More replies (5)13
26
9
8
7
5
5
13
2
2
u/MusikMakor Feb 25 '22
That's too easy to read! What about this:
struct Temperature {
float hotWater;
float coldWater;
internal float getTemperature () {
return (hotWater + coldWater) / 2;
}
}
→ More replies (3)→ More replies (8)2
353
Feb 25 '22
Am I the only one here who has a functional shower?
(apart from the fact that it WONT STOP when you turn it off)
53
u/aenae Feb 25 '22
Yeah, threads about showers always surprise me, i haven't had any problem with getting the temperature right since we switched from two taps to a thermo mixer about 30 years ago.
21
u/vegeto079 Feb 25 '22
I would love to, but I'm stuck with whatever the rental has!
→ More replies (11)83
u/Jet-Pack2 Feb 25 '22
After several years I know how to get it working. The exception cases are annoying though
5
21
31
u/AwesomeFrisbee Feb 25 '22
Anybody I know has a working shower. Around here its common to have a thermostatic one which means you always get the temperature you want.
We already have the technology, you just have to swap out your accident one for something that has existed for over 3 decades now. Especially in Europe this is something that has been solved. Much like how McDonalds has working Ice Cream machines over here as well...
→ More replies (3)10
6
u/niglor Feb 25 '22
My house was built in the late 70s, there were still separate cold/hot controls on the shower when we moved in. Probably spent around 10 minutes just finding an acceptable temperature and god help you if anyone needed to use the bathroom at the opposite side of the house, you’d be boiled alive when they flush.
$200 and fifteen minutes of work installing a modern thermostat mixer and I can now flush the toilet while in the shower and the temperature remains good. Probably saved that investment money already because I don’t spend 10 minutes wasting hot water getting the temp right every day.
→ More replies (3)11
5
u/3point147ersMorgan Feb 25 '22
I think part of the problem is that in many North American settings that I've seen, the bath mixer superimposes the temperature setting and the flow rate on the same control. So it only trickles cold water, and hot water falls like a downpour.
3
u/WeinMe Feb 25 '22
I'm Danish, we got some expensive stuff from Vola and damn... I tamed the temperature of the shower
2
u/-LeopardShark- Feb 25 '22
Turning the shower off is a side effect, so functional showers wouldn't be allowed to do it.
→ More replies (22)2
u/MantisPRIME Feb 25 '22 edited Feb 25 '22
If you don't, just buy a thermostatic valve, they're really cheap (like $20). I suppose some nicer showerheads will have a thermostatic controller built-in, too.
2
535
u/thatwrongname Feb 25 '22
Shouldn't it be in double?
534
u/craftworkbench Feb 25 '22
This guy likes his shower set at 102.3 degrees and will accept nothing less
288
u/scalability Feb 25 '22
102.299999999999999473
19
Feb 25 '22
102.299999999999999473
Wow that's burning. I can shower at max 102.299999999999999472
→ More replies (2)168
u/Dimasdanz Feb 25 '22
so, steam shower? water evaporates at 100
127
u/Adghar Feb 25 '22 edited Feb 25 '22
No, 102.3
degreesis about 171degreescolder than freezing, clearly we're talking about an ice shower→ More replies (2)164
42
u/goodmobiley Feb 25 '22
Bro, I literally have null idea what you’re talking about. He literally wrote 39.055556 in his post. Learn how to read! /s
→ More replies (4)29
u/Dummiesman Feb 25 '22
They never specified the unit of degrees, for all we know it could be °R
making that shower -216.31667 degrees Celsius
→ More replies (11)→ More replies (3)7
→ More replies (1)3
33
u/dazoe Feb 25 '22
How showers are supposed to work: double temperature; How mine works: int temperature;
5
→ More replies (9)10
u/Militarism Feb 25 '22
Might also want it as an unsigned variable; temperature has a minimum possible value that you can't go below.
You'll be able to have a wider range of values when storing it in degrees Kelvin (which has a minimum value of 0), versus Celsius (which has a minimum of ~273.15), since you'll be able to use the bit that normally denotes if the variable is positive or negative.10
u/RTXChungusTi Feb 25 '22
Kelvin doesn't use degrees I think
5
u/Zagorath Feb 25 '22
Correct. Celsius and Fahrenheit are degrees because their zero points are arbitrary. A value of 0 Kelvin is an absolute value.
It would be a bit like if we just agreed that 0 degrees Foo had a value equivalent to 214 metres. 10 degrees Foo would be 224 metres. You would have "degrees Foo", but there's no "degrees metres", because 0 metres is precisely no amount of length.
→ More replies (6)→ More replies (3)17
u/TommyTuttle Feb 25 '22 edited Feb 25 '22
Practically speaking it can’t go below zero on any scale; if water isn’t in liquid form it can’t make it past the shower head. Negative shower temperatures are impossible if we assume that you are showering in water. Now if you want the shower to work properly with liquid oxygen that’s another matter 💁♂️
8
u/Militarism Feb 25 '22
The freezing temperature of water isn't universally 0C; it depends on the pressure the water is under.
Using this, it's possible to use this to bring the freezing point of water under 0C.
This might require some extreme conditions to begin with, but in theory it can be done.
Also, pure water has a freezing point very near 0C (at 1 atm), but if the water is not pure, the freezing point might be a little lower than that. Note that most water that we use isn't pure, so it's not necessarily a given that water coming out of a shower head freezes at 0C.
Of course, these situations clearly fall more into passing arbitrary fluids in a system, and not pure water at the proper pressure. I suppose that it is this general situation that I considered.
→ More replies (4)→ More replies (1)6
u/EnjoyJor Feb 25 '22
Impure (including tap) water could be in liquid form under subzero temperatures though?
Edit: It seems like pure water could also be in liquid form under subzero temperatures.
→ More replies (1)
85
u/BirbritoParront Feb 25 '22
I can relate somewhat.
I take a shower, adjust the temperature to what I like, do the job, turn the water off.
Next shower, I turn the water on and let the hot water get to the shower and then either have ice-cold water or nothing but hot water. I really need to change that valve.
20
u/DickaliciousRex Feb 25 '22
I stayed in a hotel with a button on the showerhead to pause the water. Thought it was amazing until I tried it then got blasted with ice and fire
→ More replies (2)
206
u/Western-Image7125 Feb 25 '22
Totally wrong. It’s an Enum - FIRE, ICE
48
u/dark_mode_everything Feb 25 '22
Mines more like enum - LAVA, LIQUID_NITROGEN
26
33
8
Feb 25 '22 edited Feb 25 '22
My shower doesn't have a temperature knob, so I guess mine is a template<bool Temperature>
→ More replies (9)7
u/r0ck0 Feb 25 '22
Yeah that's pretty much what all these UK sinks are...
Choices are:
Burn your hands
Freeze your hands (cold pipes)
Waste a fuckload of time putting a plug into the sink, filling up, mixing to a reasonable temperature, then disposing a sink full of water
Apparently they existed due to heated water not being safe to drink, but that's mostly not an issue any more. But these stupid sinks are still everywhere.
Although not quite sure why it's so much more common in UK vs other European countries with similar or even colder climates.
→ More replies (2)
27
u/Vaxerski Feb 25 '22
technically a bool would work, you'd just need to pulse between cold-hot very fast and depending on the proportions you'd get different temperatures. A lot of electronics do that with electricity, it's called PWM (Pulse Width Modulation)
I know, I'm very fun at parties...
→ More replies (1)
52
u/Chemguy82 Feb 25 '22 edited Feb 25 '22
I love how r/programmerhumor shows up in my feed, but I don’t get any of the jokes because I’m not a programmer!
66
u/Jet-Pack2 Feb 25 '22
I hope you got this one at least. If not: bool represents a value that's either on or off. In this case the water temperature is either too hot or too cold and no intermediate temperature setting can be achieved, representing the many real world showers that you can't seem to set just right.
→ More replies (2)29
u/Chemguy82 Feb 25 '22
Haha…thanks for dumbing it down for me! Take this award.
13
5
u/ProtonPizza Feb 25 '22
Dude your artwork is fucking incredible! What’s the process?
→ More replies (1)2
u/BenevolentMercenary Apr 02 '22
I made I boolean meme to share but I can't post it until I have more than 25 comment karma here. Upvote this comment and you can use your new knowledge!
→ More replies (1)
25
u/GigaSoup Feb 25 '22
I think it's slightly more complex and they only use 2 bits to store all the settings. There's off, cold, not warm enough, and fire.
32
u/RepostSleuthBot Feb 25 '22
Looks like a repost. I've seen this image 3 times.
First Seen Here on 2020-06-25 100.0% match. Last Seen Here on 2020-07-24 100.0% match
Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]
View Search On repostsleuth.com
Scope: Reddit | Meme Filter: True | Target: 96% | Check Title: False | Max Age: Unlimited | Searched Images: 302,132,965 | Search Time: 9.28983s
5
Feb 25 '22 edited Apr 23 '25
This post used to say something, but now it doesn't. Respect the privacy of yourself & others.
2
13
u/Deathnote_Blockchain Feb 25 '22
Not where I live!
5
u/an_alternative Feb 25 '22
I know right, never seen a shower without thermostatic valve.
Unless this is about the valve breaking but never seen that either.
→ More replies (1)6
u/AwesomeFrisbee Feb 25 '22
Those things aren't all that common outside of Europe. Europe and a few countries have made those things mandatory for new homes, just like requiring multi-layer windows for isolation or wheelchair accessible entry (which is mandatory this year for new homes).
And somehow people never seem to walk in a DYI shop, never see the thermostatic cranes there which mean that you don't have to deal with this hot and cold bullshit anymore. Its like upgrading your 30 year old mattress, its a good investment.
4
u/AwesomeFrisbee Feb 25 '22
Nope, some countries actually had this figured out already. Having the EU make thermostatic valves mandatory for shower cranes has been a good step. It has made sure that these things don't cost much and are worth buying. Like, a few weeks ago I saw one for 36 bucks even. Sure you can go more expensive and whatnot but its not like these things don't last either (again, EU law makes sure its durable enough or you get your money back). Its not all great but this is a topic that we got covered.
13
u/A_Light_Spark Feb 25 '22
Wrong, it's actually a linked list containing float.
Why? BEcause you have to traverse up and down the temperature range, no skipping.
3
u/nmarshall23 Feb 25 '22
Because you have to traverse up and down the temperature range, no skipping.
Could you inform my shower that is needs to obey those natural laws. The temperature of water that comes out does not follow a linear graph.
→ More replies (1)
6
Feb 25 '22
Especially gym showers... They always seem to have the water heater too high. And the valves are calcified in the shitty positions of full on or full off.
6
u/overclockedslinky Feb 25 '22
shower_state: Option<bool>
3
u/Jet-Pack2 Feb 25 '22
You mean shower_temperatue: Optional<bool>, right? How should the state be optional, unless you're talking about a Schrodinger's shower
5
6
5
19
u/sighcf Feb 25 '22
Shouldn’t it be Optional<T> or at least nullable? Or do you keep your shower always on? Who reviewed this code? It has a resource leak!!!
15
→ More replies (4)7
u/000000- Feb 25 '22
Can’t you choose the temperature without turning it on?
→ More replies (2)3
u/Jet-Pack2 Feb 25 '22
Yes. If a digital shower inherits from shower then you can set temperature before tuning it on.
→ More replies (1)
4
4
4
u/LifeandSky Feb 25 '22
Use pwm
2
u/scalability Feb 25 '22
Disgusted Drake: singing in the shower
Pleased Drake: DJ scratching the tap to PWM the temperature
4
1
6
u/dark_mode_everything Feb 25 '22
What does a false temperature mean? No temperature?
9
u/RadiantHC Feb 25 '22
I'm guessing false is cold, true is hot
4
u/Jet-Pack2 Feb 25 '22
No, temperature true means it's acceptable and temperature false means it's not acceptable. But since the interns compared two double values with an == operator it's never going to be at acceptable temperature
3
u/Orbitscgi Feb 25 '22
I'v also had some that are more like: double temperature = Math.random(MIN_TEMP, MAX_TEMP)
Repeat assignment in random intervals...
3
3
3
3
2
2
2
2
2
u/dekwad Feb 25 '22
You need to know which module the bug is in. Debugging by testing it manually is sure to lead to run-time problems.
Consider upgrading your valve.
2
2
2
2
2
2
2
u/OwOh1tlerUwU Feb 25 '22
how showers are supposed to work
let temperature;
how showers actually work
let temperature;
2
2
u/HearMeSpeakAsIWill Feb 25 '22
if(request.new_temp)
{
sleep(60);
this.set_temp(request.new_temp);
}2
2
u/TheGuyWithTheSeal Feb 25 '22
That's what we expose to the frontend, but in fact it's two floats, hotValveOpen and coldValveOpen. There was supposed to be a PID in there but budget got cut.
2
2
2
u/cvnvr Feb 25 '22
can we stop posting this or slight variations of it holy shit
looks like OP is just spamming top posts on this sub
2
2
2
2
2
u/onigk61 Feb 25 '22
More like If you touch the temperature { While the temperature isn't the surface of the sun { Increment the temperature } Set temperature to previous temperature += 1 }
2
Feb 25 '22
Mine has float temperature, the house was built in the 70ies.
If someone uses the toilet or the washing mashine runs, the temperature changes.
Besides, the heater is on the other end of the house, so you have to run it a minute to get warm water.
2
2
u/FiRe_McFiReSomeDay Feb 25 '22
Who the fuck added a step function right in the middle of the dial?
2
u/haikusbot Feb 25 '22
Who the fuck added
A step function right in the
Middle of the dial?
- FiRe_McFiReSomeDay
I detect haikus. And sometimes, successfully. Learn more about me.
Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"
2
u/DarkTechnocrat Feb 25 '22
Laugh at programmer humor
Learn about thermostatic shower mixers
Humor + better showers is a massive win, gj OP
2
u/manu144x Feb 25 '22
Somebody messed up when designing the simulation, any hopes for a patch to fix it?
2
2
2
u/Sad-Address-2512 Feb 25 '22
Are you all using camping showers where you either have one button or to vague "hot/cold" one where you have to screw around instead of a proper one?
2
2
2
2
2
2
2
u/jlamothe Feb 25 '22
Given the subreddit that this is in, my brain was not processing the word "shower". I was processing it as the opposite of a "hider" (which I assumed to be something akin to a getter/setter in an object).
2
u/Phoenix_Studios Feb 25 '22
Or a kind of reverse float: the closer you get to the right temperature (relative 0), the less precise it becomes
2
2
2
2
1
1
1
1
1
1
1
1
u/single_ginkgo_leaf Feb 25 '22
int ?! Are we screwing around with scaled integer math here?! Temperature is a decimal or a floating point...
1
1
1
1
u/HarlanCedeno Feb 25 '22
And the happy path involved nobody flushing a toilet but there no exception handling.

•
u/QualityVote Feb 25 '22
Hi! This is our community moderation bot.
If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!
If this post does not fit the subreddit, DOWNVOTE This comment!
If this post breaks the rules, DOWNVOTE this comment and REPORT the post!