Skip to main content
1 of 4
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Un-average temperatures!

There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur).

So, now the issue is, most people don't use this system. So, I need a program to convert back from this average!

Challenge

Given the average of the Celsius, Fahrenheit, Kelvin, and Rankine representations of a certain temperature, output the individual standard representations, in any prespecified and consistent order. It turns out that this is possible, based on my whiteboard calculations. Input will be a single floating-point value in whatever range your language can handle, and output will be four floating-point values in any reasonable format. You can restrict the input to force the output to be in the range of your language, but you must be able to support down to Absolute Zero (thus, you need to be able to handle negative numbers).

Test Cases

input -> output
100 -> Celsius:    -70.8607142857
       Fahrenheit: -95.5492857143
       Kelvin:     202.289285714
       Rankine:    363.120714286
20 -> Celsius:    -128.003571429
      Fahrenheit: -198.406428571
      Kelvin:     145.146428571
      Rankine:    260.263571429
-10 -> Celsius:    -149.432142857
       Fahrenheit: -236.977857143
       Kelvin:     123.717857143
       Rankine:    221.692142857
-200 -> Celsius:    -285.146428571
        Fahrenheit: -481.263571429
        Kelvin:     -11.9964285714
        Rankine:    -22.5935714286 // Note: Your program does not need to handle this because it has negative temperature
10000 -> Celsius:    7000.56785714
         Fahrenheit: 12633.0221429
         Kelvin:     7273.71785714
         Rankine:    13091.6921429
user42649
  • 42.6k
  • 5
  • 68
  • 224