![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Conversion from Kelvin to Celsius degrees. More...
#include <cassert>#include <cmath>#include <iostream>Go to the source code of this file.
Namespaces | |
| namespace | others |
| for vector | |
Functions | |
| bool | others::are_almost_equal (double a, double b, double absolute_tolerance=0.0001) |
| Compare two floating point numbers with a certain tolerance. This is needed as with some values, the result (e.g.: -196.15) might be a bit lower (in this case, -196.499999...). | |
| double | others::kelvin_to_celsius (double temperature_in_k) |
| Conversion from Kelvin to Celsius algorithm. | |
| static void | tests () |
| Self-test implementations. | |
| int | main () |
| Main function. | |
Conversion from Kelvin to Celsius degrees.
The algorithm consists on converting a Kelvin degree value to a Celsius value. The formula to convert a Kelvin to a Celsius value is:
\[ C = K - 273.15 \]
where:
Check out Kelvin and Celsius on Wikipedia for more information about their story, how do they work, when and why they should be used, etc..
Definition in file kelvin_to_celsius.cpp.
| int main | ( | void | ) |
Main function.
Definition at line 78 of file kelvin_to_celsius.cpp.
|
static |
Self-test implementations.
Definition at line 62 of file kelvin_to_celsius.cpp.