29 #if !defined OPM_COMMON_QUAD_HPP && HAVE_QUAD 30 #define OPM_COMMON_QUAD_HPP 39 #include <type_traits> 45 typedef __float128 quad;
52 class numeric_limits<quad>
55 static constexpr
bool is_specialized =
true;
57 static constexpr quad min() throw()
58 {
return FLT128_MIN; }
59 static constexpr quad max() throw()
60 {
return FLT128_MAX; }
63 static constexpr
int digits = FLT128_MANT_DIG;
65 static constexpr
int digits10 = FLT128_DIG;
66 static constexpr
bool is_signed =
true;
67 static constexpr
bool is_integer =
false;
68 static constexpr
bool is_exact =
false;
69 static constexpr
int radix = 0;
70 static constexpr quad epsilon() throw()
71 {
return FLT128_EPSILON; }
72 static constexpr quad round_error() throw()
75 static constexpr
int min_exponent = FLT128_MIN_EXP;
76 static constexpr
int min_exponent10 = FLT128_MIN_10_EXP;
77 static constexpr
int max_exponent = FLT128_MAX_EXP;
78 static constexpr
int max_exponent10 = FLT128_MAX_10_EXP;
80 static constexpr
bool has_infinity =
true;
81 static constexpr
bool has_quiet_NaN =
true;
82 static constexpr
bool has_signaling_NaN =
true;
83 static constexpr float_denorm_style has_denorm = denorm_present;
84 static constexpr
bool has_denorm_loss =
false;
85 static constexpr quad infinity() throw()
86 {
return __builtin_huge_valq(); }
87 static constexpr quad quiet_NaN() throw()
88 {
return __builtin_nan(
""); }
89 static constexpr quad signaling_NaN() throw()
90 {
return __builtin_nans(
""); }
91 static constexpr quad denorm_min() throw()
92 {
return FLT128_DENORM_MIN; }
94 static constexpr
bool is_iec559 =
true;
95 static constexpr
bool is_bounded =
true;
96 static constexpr
bool is_modulo =
false;
98 static constexpr
bool traps = std::numeric_limits<double>::traps;
99 static constexpr
bool tinyness_before = std::numeric_limits<double>::tinyness_before;
100 static constexpr float_round_style round_style = round_to_nearest;
102 #endif // LIMITS_HAS_QUAD 106 struct is_floating_point<quad>
107 :
public integral_constant<bool, true>
111 struct is_arithmetic<quad>
112 :
public integral_constant<bool, true>
116 struct is_fundamental<quad>
117 :
public integral_constant<bool, true>
121 struct is_scalar<quad>
122 :
public integral_constant<bool, true>
125 #if __cplusplus < 202002L 128 :
public integral_constant<bool, true>
133 struct is_signed<quad>
134 :
public integral_constant<bool, true>
139 struct is_standard_layout<quad>
140 :
public integral_constant<bool, true>
144 struct is_trivial<quad>
145 :
public integral_constant<bool, true>
155 template <
class OtherType>
156 struct is_assignable<quad, OtherType>
157 :
public integral_constant<bool, is_arithmetic<OtherType>::value>
160 template <
class OtherType>
161 struct is_nothrow_assignable<quad, OtherType>
162 :
public is_assignable<quad, OtherType>
173 struct is_copy_assignable<quad>
174 :
public integral_constant<bool, true>
178 struct is_nothrow_copy_assignable<quad>
179 :
public integral_constant<bool, true>
183 struct is_move_assignable<quad>
184 :
public integral_constant<bool, true>
188 struct is_nothrow_move_assignable<quad>
189 :
public integral_constant<bool, true>
193 struct is_constructible<quad>
194 :
public integral_constant<bool, true>
198 struct is_nothrow_constructible<quad>
199 :
public integral_constant<bool, true>
203 struct is_default_constructible<quad>
204 :
public integral_constant<bool, true>
208 struct is_nothrow_default_constructible<quad>
209 :
public integral_constant<bool, true>
220 struct is_copy_constructible<quad>
221 :
public integral_constant<bool, true>
225 struct is_move_constructible<quad>
226 :
public integral_constant<bool, true>
230 struct is_nothrow_move_constructible<quad>
231 :
public integral_constant<bool, true>
236 struct is_destructible<quad>
237 :
public integral_constant<bool, true>
241 struct is_nothrow_destructible<quad>
242 :
public integral_constant<bool, true>
245 template <
class OtherType>
246 struct is_convertible<quad, OtherType>
247 :
public is_arithmetic<OtherType>
250 #if !QUADMATH_HAS_IO_OPERATOR 251 inline std::ostream& operator<<(std::ostream& os,
const quad& val)
253 if (os.precision() > std::numeric_limits<double>::digits10)
254 throw std::runtime_error(
"The precision requested for output cannot " 255 "be represented by a double precision floating " 258 return os << static_cast<double>(val);
261 inline typename std::istream& operator>>(std::istream& is, quad& val)
264 std::istream& ret = (is >> tmp);
270 #if !QUADMATH_HAS_MATH_OPERATORS 271 inline quad real(quad val)
274 inline quad real(
const std::complex<quad>& val)
275 {
return val.real(); }
277 inline quad imag(quad)
280 inline quad imag(
const std::complex<quad>& val)
281 {
return val.imag(); }
283 inline quad abs(quad val)
284 {
return (val < 0) ? -val : val; }
286 inline quad floor(quad val)
287 {
return floorq(val); }
289 inline quad ceil(quad val)
290 {
return ceilq(val); }
293 inline quad max(quad a, quad b)
294 {
return (a > b) ? a : b; }
296 inline quad min(quad a, quad b)
297 {
return (a < b) ? a : b; }
300 inline quad sqrt(quad val)
301 {
return sqrtq(val); }
302 #endif // !QUADMATH_HAS_MATH_OPERATORS 304 template <
class ExpType>
305 inline quad pow(quad base, ExpType exp)
306 {
return powq(base, static_cast<quad>(exp)); }
308 template <
class BaseType>
309 inline quad pow(BaseType base, quad exp)
310 {
return powq(static_cast<quad>(base), exp); }
312 #if !QUADMATH_HAS_MATH_OPERATORS 313 inline quad pow(quad base, quad exp)
314 {
return powq(base, exp); }
316 inline quad exp(quad val)
317 {
return expq(val); }
319 inline quad log(quad val)
320 {
return logq(val); }
322 inline quad sin(quad val)
323 {
return sinq(val); }
325 inline quad cos(quad val)
326 {
return cosq(val); }
328 inline quad tan(quad val)
329 {
return tanq(val); }
331 inline quad atan(quad val)
332 {
return atanq(val); }
334 inline quad atan2(quad a, quad b)
335 {
return atan2q(a, b); }
337 inline quad round(quad val)
338 {
return roundq(val); }
340 inline bool isfinite(quad val)
341 {
return finiteq(val); }
343 inline bool isnan(quad val)
344 {
return isnanq(val); }
346 inline bool isinf(quad val)
347 {
return isinfq(val); }
348 #endif // QUADMATH_HAS_MATH_OPERATORS 352 namespace std::numbers {
354 inline constexpr quad pi_v<quad> = M_PIq;
361 #include <dune/common/classname.hh> 365 inline std::string className<__float128>()
369 #endif // HAVE_DUNE_COMMON 372 #include <dune/fem/io/streams/streams_inline.hh> 376 template <
class Traits>
377 inline OutStreamInterface<Traits>&
378 operator<<(OutStreamInterface<Traits>& out, quad
value)
380 out.writeDouble(static_cast<double>(
value));
384 template <
class Traits>
385 inline InStreamInterface<Traits>&
386 operator>>(InStreamInterface<Traits>& in, quad&
value)
395 #endif // HAVE_DUNE_FEM 397 #endif // OPM_COMMON_QUAD_HPP Definition: SymmTensor.hpp:23