KiCad PCB EDA Suite
Loading...
Searching...
No Matches
common/transline_calculations/units.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1992-2011 jean-pierre.charras
3
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this package; see the file COPYING. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
18
* Boston, MA 02110-1301, USA.
19
*
20
*/
21
22
#ifndef TRANSLINE_CALCULATIONS_UNITS_H
23
#define TRANSLINE_CALCULATIONS_UNITS_H
24
25
26
#include <cmath>
27
28
29
#ifndef HAVE_CMATH_ASINH
30
inline
double
asinh
(
double
x )
31
{
32
return
log( x + sqrt( x * x + 1 ) );
33
}
34
#endif
35
36
#ifndef HAVE_CMATH_ACOSH
37
inline
double
acosh
(
double
x )
38
{
39
// must be x>=1, if not return Nan (Not a Number)
40
if
( x < 1.0 )
41
return
sqrt( -1.0 );
42
43
// return only the positive result (as sqrt does).
44
return
log( x + sqrt( x * x - 1.0 ) );
45
}
46
#endif
47
48
#ifndef HAVE_CMATH_ATANH
49
inline
double
atanh
(
double
x )
50
{
51
// must be x>-1, x<1, if not return Nan (Not a Number)
52
if
( !( x > -1.0 && x < 1.0 ) )
53
return
sqrt( -1.0 );
54
55
return
log( ( 1.0 + x ) / ( 1.0 - x ) ) / 2.0;
56
}
57
#endif
58
59
namespace
TRANSLINE_CALCULATIONS
60
{
61
constexpr
double
MU0
= 12.566370614e-7;
// magnetic constant
62
constexpr
double
E0
= 8.854e-12;
// permittivity of free space
63
constexpr
double
C0
= 299792458.0;
// speed of light in vacuum
64
constexpr
double
ZF0
= 376.730313668;
// wave resistance in vacuum
65
66
// const to convert a attenuation / loss from log (Neper) to decibel
67
// (1 Np = 8.68589 dB)
68
const
double
LOG2DB
= 20.0 / log( 10.0 );
69
70
// ZF0 value update:
71
// https://physics.nist.gov/cgi-bin/cuu/Value?z0
72
};
// namespace TRANSLINE_CALCULATIONS
73
74
#endif
// TRANSLINE_CALCULATIONS_UNITS_H
asinh
double asinh(double x)
Definition:
common/transline_calculations/units.h:30
atanh
double atanh(double x)
Definition:
common/transline_calculations/units.h:49
acosh
double acosh(double x)
Definition:
common/transline_calculations/units.h:37
TRANSLINE_CALCULATIONS
Definition:
common/transline_calculations/units.h:60
TRANSLINE_CALCULATIONS::MU0
constexpr double MU0
Definition:
common/transline_calculations/units.h:61
TRANSLINE_CALCULATIONS::E0
constexpr double E0
Definition:
common/transline_calculations/units.h:62
TRANSLINE_CALCULATIONS::LOG2DB
const double LOG2DB
Definition:
common/transline_calculations/units.h:68
TRANSLINE_CALCULATIONS::C0
constexpr double C0
Definition:
common/transline_calculations/units.h:63
TRANSLINE_CALCULATIONS::ZF0
constexpr double ZF0
Definition:
common/transline_calculations/units.h:64
src
common
transline_calculations
units.h
Generated on Tue Aug 12 2025 00:06:46 for KiCad PCB EDA Suite by
1.9.6