CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
numericLimits.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35#pragma once
36
37#include <limits>
38
39#include "../config.h"
40#include "../misc/macros.hpp"
41#include "realTraits.hpp"
42
44namespace codi {
45
46 template<typename T_Tape>
47 struct ActiveType;
48
49 template<typename T_Tape, typename T_ParallelToolbox>
50 struct ParallelActiveType;
51}
52
53namespace std {
54
56 template<typename Type>
58 private:
60
61 public:
62
63 static bool constexpr is_specialized = true;
64 static Type constexpr min() {
65 return Type(numeric_limits<Passive>::min());
66 }
67 static Type constexpr max() {
68 return Type(numeric_limits<Passive>::max());
69 }
70 static Type constexpr lowest() {
71 return Type(numeric_limits<Passive>::lowest());
72 }
73 static int constexpr digits = numeric_limits<Passive>::digits;
74 static int constexpr digits10 = numeric_limits<Passive>::digits10;
75 static bool constexpr is_signed = numeric_limits<Passive>::is_signed;
76 static bool constexpr is_integer = numeric_limits<Passive>::is_integer;
77 static bool constexpr is_exact = numeric_limits<Passive>::is_exact;
78 static int constexpr radix = numeric_limits<Passive>::radix;
79 static Type constexpr epsilon() {
80 return Type(numeric_limits<Passive>::epsilon());
81 }
82 static Type constexpr round_error() {
83 return Type(numeric_limits<Passive>::round_error());
84 }
85
86 static int constexpr min_exponent = numeric_limits<Passive>::min_exponent;
87 static int constexpr min_exponent10 = numeric_limits<Passive>::max_exponent10;
88 static int constexpr max_exponent = numeric_limits<Passive>::max_exponent;
89 static int constexpr max_exponent10 = numeric_limits<Passive>::max_exponent10;
90
91 static bool constexpr has_infinity = numeric_limits<Passive>::has_infinity;
92 static bool constexpr has_quiet_NaN = numeric_limits<Passive>::has_quiet_NaN;
93 static bool constexpr has_signaling_NaN = numeric_limits<Passive>::has_signaling_NaN;
94 static float_denorm_style constexpr has_denorm = numeric_limits<Passive>::has_denorm;
95 static bool constexpr has_denorm_loss = numeric_limits<Passive>::has_denorm_loss;
96 static Type constexpr infinity() {
97 return Type(numeric_limits<Passive>::infinity());
98 }
99 static Type constexpr quiet_NaN() {
100 return Type(numeric_limits<Passive>::quiet_NaN());
101 }
102 static Type constexpr signaling_NaN() {
103 return Type(numeric_limits<Passive>::signaling_NaN());
104 }
105 static Type constexpr denorm_min() {
106 return Type(numeric_limits<Passive>::denorm_min());
107 }
108
109 static bool constexpr is_iec559 = numeric_limits<Passive>::is_iec559;
110 static bool constexpr is_bounded = numeric_limits<Passive>::is_bounded;
111 static bool constexpr is_modulo = numeric_limits<Passive>::is_modulo;
112
113 static bool constexpr traps = numeric_limits<Passive>::traps;
114 static bool constexpr tinyness_before = numeric_limits<Passive>::tinyness_before;
115 static float_round_style constexpr round_style = numeric_limits<Passive>::round_style;
116 };
117
119 template<typename Tape>
120 struct numeric_limits<codi::ActiveType<Tape>> : codi_numeric_limits<codi::ActiveType<Tape>> {};
121
123 template<typename Tape, typename ParallelToolbox>
124 struct numeric_limits<codi::ParallelActiveType<Tape, ParallelToolbox>>
125 : codi_numeric_limits<codi::ParallelActiveType<Tape, ParallelToolbox>> {};
126
128 template<typename Tape>
129 struct numeric_limits<codi::ActiveTypeStatelessTape<Tape>>
130 : codi_numeric_limits<codi::ActiveTypeStatelessTape<Tape>> {};
131}
typename TraitsImplementation< Type >::PassiveReal PassiveReal
The original computation type, that was used in the application.
Definition realTraits.hpp:117
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Represents a concrete lvalue in the CoDiPack expression tree.
Definition activeType.hpp:52
Specialization of std::numeric_limits for the default CoDiPack active types.
Definition numericLimits.hpp:57
static bool constexpr traps
See numeric_limits.
Definition numericLimits.hpp:113
static bool constexpr tinyness_before
See numeric_limits.
Definition numericLimits.hpp:114
static int constexpr radix
See numeric_limits.
Definition numericLimits.hpp:78
static bool constexpr is_bounded
See numeric_limits.
Definition numericLimits.hpp:110
static Type constexpr lowest()
See numeric_limits.
Definition numericLimits.hpp:70
static bool constexpr has_denorm_loss
See numeric_limits.
Definition numericLimits.hpp:95
static bool constexpr is_modulo
See numeric_limits.
Definition numericLimits.hpp:111
static bool constexpr is_specialized
See numeric_limits.
Definition numericLimits.hpp:63
static int constexpr min_exponent
See numeric_limits.
Definition numericLimits.hpp:86
static bool constexpr has_quiet_NaN
See numeric_limits.
Definition numericLimits.hpp:92
static int constexpr min_exponent10
See numeric_limits.
Definition numericLimits.hpp:87
static Type constexpr round_error()
See numeric_limits.
Definition numericLimits.hpp:82
static Type constexpr epsilon()
See numeric_limits.
Definition numericLimits.hpp:79
static bool constexpr is_exact
See numeric_limits.
Definition numericLimits.hpp:77
static bool constexpr has_infinity
See numeric_limits.
Definition numericLimits.hpp:91
static bool constexpr is_integer
See numeric_limits.
Definition numericLimits.hpp:76
static int constexpr digits10
See numeric_limits.
Definition numericLimits.hpp:74
static Type constexpr signaling_NaN()
See numeric_limits.
Definition numericLimits.hpp:102
static Type constexpr max()
See numeric_limits.
Definition numericLimits.hpp:67
static int constexpr digits
See numeric_limits.
Definition numericLimits.hpp:73
static float_round_style constexpr round_style
See numeric_limits.
Definition numericLimits.hpp:115
static Type constexpr infinity()
See numeric_limits.
Definition numericLimits.hpp:96
static int constexpr max_exponent10
See numeric_limits.
Definition numericLimits.hpp:89
static bool constexpr is_signed
See numeric_limits.
Definition numericLimits.hpp:75
static float_denorm_style constexpr has_denorm
See numeric_limits.
Definition numericLimits.hpp:94
static Type constexpr denorm_min()
See numeric_limits.
Definition numericLimits.hpp:105
static bool constexpr is_iec559
See numeric_limits.
Definition numericLimits.hpp:109
static int constexpr max_exponent
See numeric_limits.
Definition numericLimits.hpp:88
static bool constexpr has_signaling_NaN
See numeric_limits.
Definition numericLimits.hpp:93
static Type constexpr quiet_NaN()
See numeric_limits.
Definition numericLimits.hpp:99
static Type constexpr min()
See numeric_limits.
Definition numericLimits.hpp:64