Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
precision.h
Go to the documentation of this file.
1 /*
2  * precision.h - global precision header file
3  *
4  * Copyright (C) 2005, 2006 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id$
22  *
23  */
24 
25 #ifndef __PRECISION_H__
26 #define __PRECISION_H__
27 
28 #ifndef __FLT_EPSILON__
29 #define __FLT_EPSILON__ 1.1920928955078125e-07
30 #endif
31 #ifndef __FLT_MIN__
32 #define __FLT_MIN__ 1.1754943508222875e-38
33 #endif
34 #ifndef __FLT_MAX__
35 #define __FLT_MAX__ 3.4028234663852886e+38
36 #endif
37 
38 #ifndef __DBL_EPSILON__
39 #define __DBL_EPSILON__ 2.2204460492503131e-16
40 #endif
41 #ifndef __DBL_MIN__
42 #define __DBL_MIN__ 2.2250738585072014e-308
43 #endif
44 #ifndef __DBL_MAX__
45 #define __DBL_MAX__ 1.7976931348623157e+308
46 #endif
47 
48 #if NR_DOUBLE_SIZE == 12
49 
50 #ifndef __LDBL_EPSILON__
51 #define __LDBL_EPSILON__ 1.0842021724855044e-19
52 #endif
53 #ifndef __LDBL_MIN__
54 #define __LDBL_MIN__ 3.3621031431120935e-4932
55 #endif
56 #ifndef __LDBL_MAX__
57 #define __LDBL_MAX__ 1.1897314953572318e+4932
58 #endif
59 
60 #elif NR_DOUBLE_SIZE == 16
61 
62 #ifndef __LDBL_EPSILON__
63 #define __LDBL_EPSILON__ 1.9259299443872359e-34
64 #endif
65 #ifndef __LDBL_MIN__
66 #define __LDBL_MIN__ 3.3621031431120935e-4932
67 #endif
68 #ifndef __LDBL_MAX__
69 #define __LDBL_MAX__ 1.1897314953572318e+4932
70 #endif
71 
72 #endif
73 
74 
75 #if NR_DOUBLE_SIZE == 4 /* S 23bit MAN | S 7bit EXP */
76  /* single precision */
77 #define NR_TYPE float
78 #define NR_EPSI __FLT_EPSILON__
79 #define NR_MIN __FLT_MIN__
80 #define NR_MAX __FLT_MAX__
81 #define NR_TINY 1e-6
82 #define NR_DECS "6" /* 6 digits */
83 
84 #elif NR_DOUBLE_SIZE == 8 /* S 52bit MAN | S 10bit EXP */
85  /* double precision */
86 #define NR_TYPE double
87 #define NR_EPSI __DBL_EPSILON__
88 #define NR_MIN __DBL_MIN__
89 #define NR_MAX __DBL_MAX__
90 #define NR_TINY 1e-12
91 #define NR_DECS "11" /* 15 digits */
92 
93 #elif NR_DOUBLE_SIZE == 12 /* S 63bit MAN | S 14bit EXP */
94  /* IEEE 80-bit floating point */
95 #define NR_TYPE long double
96 #define NR_EPSI __LDBL_EPSILON__
97 #define NR_MIN __LDBL_MIN__
98 #define NR_MAX __LDBL_MAX__
99 #define NR_TINY 1e-15
100 #define NR_DECS "15" /* 18 digits */
101 
102 #elif NR_DOUBLE_SIZE == 16 /* S 112bit MAN | S 14bit EXP */
103  /* IEEE 128-bit floating point */
104 #define NR_TYPE long double
105 #define NR_EPSI __LDBL_EPSILON__
106 #define NR_MIN __LDBL_MIN__
107 #define NR_MAX __LDBL_MAX__
108 #define NR_TINY 1e-15
109 #define NR_DECS "15" /* 33 digits */
110 
111 #endif
112 
113 #define NR_INF nr_inf
114 #define NR_NAN nr_nan
115 
116 __BEGIN_DECLS
117 
118 extern nr_double_t nr_inf;
119 extern nr_double_t nr_nan;
120 
121 void precinit (void);
122 
123 __END_DECLS
124 
125 #endif /* __PRECISION_H__ */
nr_double_t nr_nan
Definition: precision.c:34
__BEGIN_DECLS nr_double_t nr_inf
Definition: precision.c:33
void precinit(void)
Definition: precision.c:36