nmx
xunits.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
xerror.h
"
4
#include <gsl/gsl_const_mksa.h>
5
#include <gsl/gsl_math.h>
6
10
namespace
nmx
{
11
12
//Längen km -> m, cm -> m und mm -> m
13
constexpr
double
operator
""
_km(
long
double
x) {
14
return
static_cast<
double
>
(x) * 1e3;
15
}
16
17
constexpr
double
operator
""
_cm(
long
double
x) {
18
return
static_cast<
double
>
(x) * 1e-2;
19
}
20
21
constexpr
double
operator
""
_mm(
long
double
x) {
22
return
static_cast<
double
>
(x) * 1e-3;
23
}
24
25
//**Winkel deg -> rad
26
constexpr
double
operator
""
_deg(
long
double
x) {
27
return
static_cast<
double
>
(x) * M_PI / 180.0;
28
}
29
30
//**Massen g -> kg
31
constexpr
double
operator
""
_g(
long
double
x) {
32
return
static_cast<
double
>
(x) * 1e-3;
33
}
34
35
//**Zeit Stunden -> s und Minuten -> s
36
constexpr
double
operator
""
_h(
long
double
x) {
37
//benutze gsl-Konstante zur Berechnung
38
return
(static_cast<double>(x) * GSL_CONST_MKSA_HOUR);
39
}
40
41
constexpr
double
operator
""
_min(
long
double
x) {
42
//benutze gsl-Konstante zur Berechnung
43
return
(static_cast<double>(x) * GSL_CONST_MKSA_MINUTE);
44
}
45
46
}
// namespace nmx
nmx
xerror.h
Generated by
1.8.13