Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::GenericNumTraits< T > Struct Template Reference

Numeric traits for an arithmetic scalar type; the reusable base NumTraits forwards to. More...

#include <NumTraits.hpp>

Inheritance diagram for mundy::GenericNumTraits< T >:
[legend]

Public Types

using Real = T
 The real-valued counterpart of T (T itself for real scalars).
using NonInteger = std::conditional_t<std::is_integral_v<T>, double, T>
 A type closed under division and roots; integers widen to double, others are unchanged.
using Literal = T
 The type of a numeric literal paired with a value of type T.

Static Public Member Functions

static constexpr Real epsilon ()
 Machine epsilon: the gap between 1 and the next representable value.
static constexpr Real dummy_precision ()
 Loose tolerance for fuzzy comparisons; 0 for exact types.
static constexpr Real highest ()
 Largest finite representable value.
static constexpr Real lowest ()
 Most negative finite representable value (min() for integers, -max() for floats).
static constexpr Real norm_min ()
 Smallest positive normalized value.
static constexpr Real infinity ()
 Positive infinity (or highest() for types without an infinity).
static constexpr Real quiet_NaN ()
 A quiet NaN.

Static Public Attributes

static constexpr bool IsInteger = std::is_integral_v<T>
 Whether T represents integers.
static constexpr bool IsSigned = std::is_signed_v<T>
 Whether T is a signed type.
static constexpr bool IsComplex = false
 Whether T is complex; always false (complex scalars are not supported).
static constexpr bool RequireInitialization = !std::is_arithmetic_v<T>
 Whether T must be constructed before use (true for non-trivial custom scalars).

Detailed Description

template<typename T>
struct mundy::GenericNumTraits< T >

Custom-scalar specializations must expose this same member set.

Template Parameters
TAn arithmetic scalar type.

Member Typedef Documentation

◆ Real

template<typename T>
using mundy::GenericNumTraits< T >::Real = T

◆ NonInteger

template<typename T>
using mundy::GenericNumTraits< T >::NonInteger = std::conditional_t<std::is_integral_v<T>, double, T>

◆ Literal

template<typename T>
using mundy::GenericNumTraits< T >::Literal = T

Member Function Documentation

◆ epsilon()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::epsilon ( )
inlinestaticconstexpr

◆ dummy_precision()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::dummy_precision ( )
inlinestaticconstexpr

◆ highest()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::highest ( )
inlinestaticconstexpr

◆ lowest()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::lowest ( )
inlinestaticconstexpr

◆ norm_min()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::norm_min ( )
inlinestaticconstexpr

◆ infinity()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::infinity ( )
inlinestaticconstexpr

◆ quiet_NaN()

template<typename T>
constexpr Real mundy::GenericNumTraits< T >::quiet_NaN ( )
inlinestaticconstexpr

Member Data Documentation

◆ IsInteger

template<typename T>
bool mundy::GenericNumTraits< T >::IsInteger = std::is_integral_v<T>
staticconstexpr

◆ IsSigned

template<typename T>
bool mundy::GenericNumTraits< T >::IsSigned = std::is_signed_v<T>
staticconstexpr

◆ IsComplex

template<typename T>
bool mundy::GenericNumTraits< T >::IsComplex = false
staticconstexpr

◆ RequireInitialization

template<typename T>
bool mundy::GenericNumTraits< T >::RequireInitialization = !std::is_arithmetic_v<T>
staticconstexpr