Hacker News new | ask | show | jobs
by tzs 2524 days ago
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.