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

Numeric traits for a scalar-like type T. More...

#include <NumTraits.hpp>

Inheritance diagram for mundy::NumTraits< 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::NumTraits< T >

The default forwards to GenericNumTraits (valid for arithmetic primitives). Custom scalar types opt into MundyMath by specializing this template with the same member set.

Template Parameters
TThe scalar type to describe.

Member Typedef Documentation

◆ Real

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

◆ NonInteger

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

◆ Literal

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

Member Function Documentation

◆ epsilon()

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

◆ dummy_precision()

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

◆ highest()

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

◆ lowest()

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

◆ norm_min()

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

◆ infinity()

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

◆ quiet_NaN()

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

Member Data Documentation

◆ IsInteger

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

◆ IsSigned

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

◆ IsComplex

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

◆ RequireInitialization

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