FileSystemIndexer v0.1.2-beta
File System Indexer - An API to index files from your system
Loading...
Searching...
No Matches
FSI_temperatureConverter.h
Go to the documentation of this file.
1#ifndef INCLUDE_TEMPERATURE_FSI_TEMPERATURECONVERTER_H_
2#define INCLUDE_TEMPERATURE_FSI_TEMPERATURECONVERTER_H_
3
4// NOTES:
5// TC; In this context it means ("Temperature Converter")
6
7#ifdef __cplusplus
8# define __FSI_DIRUTILS_TC_CPP_OPEN extern "C" {
9# define __FSI_DIRUTILS_TC_CPP_CLOSE }
10#else
11# define __FSI_DIRUTILS_TC_CPP_OPEN
12# define __FSI_DIRUTILS_TC_CPP_CLOSE
13#endif // __cplusplus
14
16
17#include <stdbool.h>
18
19// Celcius to others
20#define __FSI_TC_CEL_TO_C(value) (value)
21#define __FSI_TC_CEL_TO_F(value) ((value) * 9.0 / 5.0 + 32.0)
22#define __FSI_TC_CEL_TO_K(value) ((value) + 273.15)
23#define __FSI_TC_CEL_TO_RE(value) ((value) * 4.0 / 5.0)
24#define __FSI_TC_CEL_TO_RA(value) (((value) + 273.15) * 9.0 / 5.0)
25
26// Others to Celcius
27#define __FSI_TC_CEL_FROM_C(value) (value)
28#define __FSI_TC_CEL_FROM_F(value) (((value) - 32.0) * 5.0 / 9.0)
29#define __FSI_TC_CEL_FROM_K(value) ((value) - 273.15)
30#define __FSI_TC_CEL_FROM_RE(value) ((value) * 5.0 / 4.0)
31#define __FSI_TC_CEL_FROM_RA(value) (((value) - 491.67) * 5.0 / 9.0)
32
33/**
34 * @brief Convert Celcius to `from` as a double
35 * @param from Convert to from celcius
36 * @param to The value of the temperature
37 * @return The exact converted temperature
38 */
39double FSI_temperatureConvertCelTo(const char *from, const double to);
40
41/**
42 * @brief Convert from `from` to Celcius as a double
43 * @param from The value of the temperature
44 * @param to From celcius to the temperature
45 * @return The exact converted temperature
46 */
47double FSI_temperatureConvertCelFrom(const char *to, const double from);
48
50
51#endif // INCLUDE_TEMPERATURE_FSI_TEMPERATURECONVERTER_H_
52
double FSI_temperatureConvertCelFrom(const char *to, const double from)
Convert from from to Celcius as a double.
double FSI_temperatureConvertCelTo(const char *from, const double to)
Convert Celcius to from as a double.
#define __FSI_DIRUTILS_TC_CPP_OPEN
#define __FSI_DIRUTILS_TC_CPP_CLOSE