00001 # ifndef CPPAD_CHECK_NUMERIC_TYPE_INCLUDED
00002 # define CPPAD_CHECK_NUMERIC_TYPE_INCLUDED
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 namespace CppAD {
00067
00068 # ifdef NDEBUG
00069 template <class NumericType>
00070 inline void CheckNumericType(void)
00071 { }
00072 # else
00073 template <class NumericType>
00074 NumericType CheckNumericType(void)
00075 {
00076 static bool runOnce = false;
00077 if( runOnce )
00078 return NumericType(0);
00079 runOnce = true;
00080
00081
00082
00083
00084 NumericType check_NumericType_default_constructor;
00085 NumericType check_NumericType_constructor_from_int(1);
00086
00087 const NumericType x(1);
00088
00089 NumericType check_NumericType_copy_constructor(x);
00090
00091
00092 NumericType check_NumericType_assignment;
00093 check_NumericType_assignment = x;
00094
00095
00096
00097
00098 const NumericType check_NumericType_unary_plus(1);
00099 NumericType check_NumericType_unary_plus_result =
00100 + check_NumericType_unary_plus;
00101
00102 const NumericType check_NumericType_unary_minus(1);
00103 NumericType check_NumericType_unary_minus_result =
00104 - check_NumericType_unary_minus;
00105
00106
00107
00108
00109 const NumericType check_NumericType_binary_addition(1);
00110 NumericType check_NumericType_binary_addition_result =
00111 check_NumericType_binary_addition + x;
00112
00113 const NumericType check_NumericType_binary_subtraction(1);
00114 NumericType check_NumericType_binary_subtraction_result =
00115 check_NumericType_binary_subtraction - x;
00116
00117 const NumericType check_NumericType_binary_multiplication(1);
00118 NumericType check_NumericType_binary_multiplication_result =
00119 check_NumericType_binary_multiplication * x;
00120
00121 const NumericType check_NumericType_binary_division(1);
00122 NumericType check_NumericType_binary_division_result =
00123 check_NumericType_binary_division / x;
00124
00125
00126
00127
00128 NumericType
00129 check_NumericType_computed_assignment_addition(1);
00130 check_NumericType_computed_assignment_addition += x;
00131
00132 NumericType
00133 check_NumericType_computed_assignment_subtraction(1);
00134 check_NumericType_computed_assignment_subtraction -= x;
00135
00136 NumericType
00137 check_NumericType_computed_assignment_multiplication(1);
00138 check_NumericType_computed_assignment_multiplication *= x;
00139
00140 NumericType
00141 check_NumericType_computed_assignment_division(1);
00142 check_NumericType_computed_assignment_division /= x;
00143
00144
00145
00146
00147 check_NumericType_default_constructor = x;
00148 return
00149 + check_NumericType_default_constructor
00150 + check_NumericType_constructor_from_int
00151 + check_NumericType_copy_constructor
00152 + check_NumericType_assignment
00153 + check_NumericType_unary_plus_result
00154 + check_NumericType_unary_minus_result
00155 + check_NumericType_binary_addition_result
00156 + check_NumericType_binary_subtraction_result
00157 + check_NumericType_binary_multiplication_result
00158 + check_NumericType_binary_division_result
00159 + check_NumericType_computed_assignment_addition
00160 + check_NumericType_computed_assignment_subtraction
00161 + check_NumericType_computed_assignment_multiplication
00162 + check_NumericType_computed_assignment_division
00163 ;
00164 }
00165 # endif
00166
00167 }
00168
00169 # endif