Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Conversion from Kelvin to Celsius degrees. More...
#include <cassert>
#include <cmath>
#include <iostream>
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..
int main | ( | void | ) |
|
static |
Self-test implementations.