|
Prev | Next | base_limits |
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.
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(Other, Base)
}
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 Base infinity(void) \
{ return static_cast<Base>( std::numeric_limits<Other>::infinity() ); }\
static const int digits10 = std::numeric_limits<Other>::digits10;\
};