News for hackers. Stuff that matters.
Re:Temperature Conversion: Mental Calculation (2014) by tzs on Sunday July 21, 2019 @01:17PM (#20492387)
The refined C to F conversion given is:

  F = 2*(C-floor(C/10)) + 31
Better is:

  F = 2*C - round(2*C/10) + 32
That's almost as easy to do in your head, but always gives the same result as doing the exact conversion and rounding that:

  F = round(9*C/5+32)
Also, if you would like the exact conversion, when you do the round(2*C/10) you can note how much the round changed the value, and that tells you how far off your final integer F temperature is from the actual value. You are high by that amount if the rounding was down, or low by that amount if the rounding went up.

There are no comments on this comment yet.