Intro_function
Functions
mylib.cpp File Reference
#include "mylib.h"
#include <cassert>

Go to the source code of this file.

Functions

float c2k (float const grad_C)
 
void c2kf (float const grad_C, float &grad_K, float &grad_F)
 

Function Documentation

◆ c2k()

float c2k ( float const  grad_C)

Calculates Kelvin from degree Celsius.

Parameters
[in]grad_CTemperature in degree Celsius
Returns
Temperature in Kelvin
Warning
No check for non-physical values (<0 Kelvin)

Definition at line 5 of file mylib.cpp.

6 {
7  float grad_K;
8  grad_K = grad_C + 273.15f; // D o n ' t d o ! 273,15
9  return grad_K;
10 }

◆ c2kf()

void c2kf ( float const  grad_C,
float &  grad_K,
float &  grad_F 
)

Calculates Kelvin and degree Fahrenheit from degree Celsius.

Parameters
[in]grad_CTemperature in degree Celsius
[out]grad_KTemperature in Kelvin
[out]grad_FTemperature in degree Fahrenheit
Warning
Code stops for non-physical values (<0 Kelvin). Compiler option -NDEBUG switches off this check.

Definition at line 14 of file mylib.cpp.

15 {
16  assert( grad_C >= -273.15f ); // Stop in case of non-physical values
17  grad_K = c2k(grad_C);
18  grad_F = 9/5.0f*grad_C + 32; // D o n ' t d o ! 9/5
19  return;
20 }
float c2k(float const grad_C)
Definition: mylib.cpp:5