ergo
template_blas_num_limits.h
Go to the documentation of this file.
1 /* Ergo, version 3.7, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2018 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4  * and Anastasia Kruchinina.
5  *
6  * This program 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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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 program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Primary academic reference:
20  * Ergo: An open-source program for linear-scaling electronic structure
21  * calculations,
22  * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23  * Kruchinina,
24  * SoftwareX 7, 107 (2018),
25  * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26  *
27  * For further information about Ergo, see <http://www.ergoscf.org>.
28  */
29 
30  /* This file belongs to the template_lapack part of the Ergo source
31  * code. The source files in the template_lapack directory are modified
32  * versions of files originally distributed as CLAPACK, see the
33  * Copyright/license notice in the file template_lapack/COPYING.
34  */
35 
36 
37 #ifndef TEMPLATE_BLAS_NUM_LIMITS_HEADER
38 #define TEMPLATE_BLAS_NUM_LIMITS_HEADER
39 
40 #include <limits>
41 
42 /* We need to include config.h to get macro PRECISION_QUAD_FLT128 */
43 #include "config.h"
44 
45 #ifdef PRECISION_QUAD_FLT128
46 #include <quadmath.h>
47 #endif
48 
49 
50 /* template_blas_get_machine_epsilon(): function for getting the
51  machine epsilon (the difference between 1 and the least value
52  greater than 1 that is representable) for the given
53  floating-point type. */
54 template<typename Treal>
55 inline static Treal template_blas_get_machine_epsilon() {
56  return std::numeric_limits<Treal>::epsilon();
57 }
58 
59 #ifdef PRECISION_QUAD_FLT128
60 template<>
61 inline __float128 template_blas_get_machine_epsilon<__float128>() {
62  return FLT128_EPSILON;
63 }
64 #endif
65 
66 
67 /* template_blas_get_num_limit_min(): function for getting the minimum
68  positive normalized value for the given floating-point type. */
69 template<typename Treal>
70 inline static Treal template_blas_get_num_limit_min() {
72 }
73 
74 #ifdef PRECISION_QUAD_FLT128
75 template<>
76 inline __float128 template_blas_get_num_limit_min<__float128>() {
77  return FLT128_MIN; // FLT128_MIN: smallest positive number with full precision
78 }
79 #endif
80 
81 
82 /* template_blas_get_num_limit_max(): function for getting the maximum
83  finite value for the given floating-point type. */
84 template<typename Treal>
85 inline static Treal template_blas_get_num_limit_max() {
87 }
88 
89 #ifdef PRECISION_QUAD_FLT128
90 template<>
91 inline __float128 template_blas_get_num_limit_max<__float128>() {
92  return FLT128_MAX; // FLT128_MAX: largest finite number
93 }
94 #endif
95 
96 
97 #endif
#define max(a, b)
Definition: integrator.cc:87
int min(int a, int b)
Definition: lin_trans.cc:66
static Treal template_blas_get_num_limit_max()
Definition: template_blas_num_limits.h:85
static Treal template_blas_get_machine_epsilon()
Definition: template_blas_num_limits.h:55
static Treal template_blas_get_num_limit_min()
Definition: template_blas_num_limits.h:70