6 #include "util/math/mathlimits.h"     8 #include "base/integral_types.h"    14 #define DEF_COMMON_LIMITS(Type)    15 #define DEF_UNSIGNED_INT_LIMITS(Type)    16 #define DEF_SIGNED_INT_LIMITS(Type)    17 #define DEF_PRECISION_LIMITS(Type)    21 #define DEF_COMMON_LIMITS(Type) \    22 const bool MathLimits<Type>::kIsSigned; \    23 const bool MathLimits<Type>::kIsInteger; \    24 const int MathLimits<Type>::kMin10Exp; \    25 const int MathLimits<Type>::kMax10Exp;    27 #define DEF_UNSIGNED_INT_LIMITS(Type) \    28 DEF_COMMON_LIMITS(Type) \    29 const Type MathLimits<Type>::kPosMin; \    30 const Type MathLimits<Type>::kPosMax; \    31 const Type MathLimits<Type>::kMin; \    32 const Type MathLimits<Type>::kMax; \    33 const Type MathLimits<Type>::kEpsilon; \    34 const Type MathLimits<Type>::kStdError;    36 #define DEF_SIGNED_INT_LIMITS(Type) \    37 DEF_UNSIGNED_INT_LIMITS(Type) \    38 const Type MathLimits<Type>::kNegMin; \    39 const Type MathLimits<Type>::kNegMax;    41 #define DEF_PRECISION_LIMITS(Type) \    42 const int MathLimits<Type>::kPrecisionDigits;    44 #endif  // not COMPILER_MSVC    46 #define DEF_FP_LIMITS(Type, PREFIX) \    47 DEF_COMMON_LIMITS(Type) \    48 const Type MathLimits<Type>::kPosMin = PREFIX##_MIN; \    49 const Type MathLimits<Type>::kPosMax = PREFIX##_MAX; \    50 const Type MathLimits<Type>::kMin = -MathLimits<Type>::kPosMax; \    51 const Type MathLimits<Type>::kMax = MathLimits<Type>::kPosMax; \    52 const Type MathLimits<Type>::kNegMin = -MathLimits<Type>::kPosMin; \    53 const Type MathLimits<Type>::kNegMax = -MathLimits<Type>::kPosMax; \    54 const Type MathLimits<Type>::kEpsilon = PREFIX##_EPSILON; \    56 const Type MathLimits<Type>::kStdError = MathLimits<Type>::kEpsilon * 32; \    57 DEF_PRECISION_LIMITS(Type) \    58 const Type MathLimits<Type>::kNaN = HUGE_VAL - HUGE_VAL; \    59 const Type MathLimits<Type>::kPosInf = HUGE_VAL; \    60 const Type MathLimits<Type>::kNegInf = -HUGE_VAL;    62 DEF_SIGNED_INT_LIMITS(int8)
    63 DEF_SIGNED_INT_LIMITS(int16)
    64 DEF_SIGNED_INT_LIMITS(int32)
    65 DEF_SIGNED_INT_LIMITS(int64)
    66 DEF_UNSIGNED_INT_LIMITS(uint8)
    67 DEF_UNSIGNED_INT_LIMITS(uint16)
    68 DEF_UNSIGNED_INT_LIMITS(uint32)
    69 DEF_UNSIGNED_INT_LIMITS(uint64)
    74 DEF_FP_LIMITS(
float, FLT)
    75 DEF_FP_LIMITS(
double, DBL)
    76 DEF_FP_LIMITS(
long double, LDBL);
    78 #undef DEF_COMMON_LIMITS    79 #undef DEF_SIGNED_INT_LIMITS    80 #undef DEF_UNSIGNED_INT_LIMITS    82 #undef DEF_PRECISION_LIMITS