Prev Next base_limits

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
Base Type Requirements for Numeric Limits

CppAD::numeric_limits
A specialization for CppAD::numeric_limits must be defined in order to use the type AD<Base> . CppAD does not use a specialization of std::numeric_limits<Base> . Since C++11, using a specialization of std::numeric_limits<Base> would require that Base be a literal type.

CPPAD_NUMERIC_LIMITS
In most cases, this macro can be used to define the specialization where the numeric limits for the type Base are the same as the standard numeric limits for the type Other . For most Base types, there is a choice of Other , for which the following preprocessor macro invocation suffices:
     namespace CppAD {
          CPPAD_NUMERIC_LIMITS(
OtherBase)
     }
where the macro is defined by
# define CPPAD_NUMERIC_LIMITS(Other, Base) \
template <> class numeric_limits<Base>\
{\
     public:\
     static Base min(void) \
     {     return static_cast<Base>( std::numeric_limits<Other>::min() ); }\
     static Base max(void) \
     {     return static_cast<Base>( std::numeric_limits<Other>::max() ); }\
     static Base epsilon(void) \
     {     return static_cast<Base>( std::numeric_limits<Other>::epsilon() ); }\
     static Base quiet_NaN(void) \
     {     return static_cast<Base>( std::numeric_limits<Other>::quiet_NaN() ); }\
     static const int digits10 = std::numeric_limits<Other>::digits10;\
};

Input File: cppad/core/base_limits.hpp