My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
units.h
Go to the documentation of this file.
1 /*
2  * units.h - some conversion definitions
3  *
4  * Copyright (C) 2001 Gopal Narayanan <gopal@astro.umass.edu>
5  * Copyright (C) 2005, 2006 Stefan Jahn <stefan@lkcc.org>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this package; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #ifndef __UNITS_H
25 #define __UNITS_H
26 
27 #include <math.h>
28 
29 #ifdef __MINGW32__
30 #define atanh(x) (0.5 * log((1.0 + (x)) / (1.0 - (x))))
31 #define asinh(x) log((x) + sqrt((x) * (x) + 1.0))
32 #define acosh(x) log((x) + sqrt((x) * (x) - 1.0))
33 #endif
34 
35 #ifndef M_PI
36 #define M_PI 3.1415926535897932384626433832795029 /* pi */
37 #endif
38 
39 #ifndef M_E
40 #define M_E 2.7182818284590452353602874713526625 /* e */
41 #endif
42 
43 #define MU0 12.566370614e-7 /* magnetic constant */
44 #define C0 299792458.0 /* speed of light in vacuum */
45 #define ZF0 376.73031346958504364963 /* wave resistance in vacuum */
46 
47 // Types of units.
48 #define UNIT_FREQ 0
49 #define UNIT_LENGTH 1
50 #define UNIT_RES 2
51 #define UNIT_ANG 3
52 
53 // Frequency units.
54 #define FREQ_GHZ 0
55 #define FREQ_HZ 1
56 #define FREQ_KHZ 2
57 #define FREQ_MHZ 3
58 
59 // Length units.
60 #define LENGTH_MIL 0
61 #define LENGTH_CM 1
62 #define LENGTH_MM 2
63 #define LENGTH_M 3
64 #define LENGTH_UM 4
65 #define LENGTH_IN 5
66 #define LENGTH_FT 6
67 
68 // Resistance units.
69 #define RES_OHM 0
70 #define RES_KOHM 1
71 
72 // Angle units.
73 #define ANG_DEG 0
74 #define ANG_RAD 1
75 
76 
77 #endif /* __UNITS_H */