72 const T tol = std::numeric_limits<T>::epsilon() * 2.;
77 if(abs((test.get_SI_factor()-unity)/unity) > tol)
79 std::cerr << std::scientific << std::setprecision(16)
80 <<
"mismatch in unit SI description, unity is not found" << std::endl
81 <<
"unit is " << test << std::endl;
85 if(abs((test.get_SI_factor()-unity)/unity) > tol)
87 std::cerr << std::scientific << std::setprecision(16)
88 <<
"mismatch in unit SI description, unity is not found" << std::endl
89 <<
"unit is " << test << std::endl;
93 if(abs((test.get_SI_factor()-unity)/unity) > tol)
95 std::cerr << std::scientific << std::setprecision(16)
96 <<
"mismatch in unit SI description, unity is not found" << std::endl
97 <<
"unit is " << test << std::endl;
101 if(abs((test.get_SI_factor()-unity)/unity) > tol)
103 std::cerr << std::scientific << std::setprecision(16)
104 <<
"mismatch in unit SI description, unity is not found" << std::endl
105 <<
"unit is " << test << std::endl;
109 if(abs((test.get_SI_factor()-unity)/unity) > tol)
111 std::cerr << std::scientific << std::setprecision(16)
112 <<
"mismatch in unit SI description, unity is not found" << std::endl
113 <<
"unit is " << test << std::endl;
117 if(abs((test.get_SI_factor()-unity)/unity) > tol)
119 std::cerr << std::scientific << std::setprecision(16)
120 <<
"mismatch in unit SI description, unity is not found" << std::endl
121 <<
"unit is " << test << std::endl;
125 if(abs((test.get_SI_factor()-unity)/unity) > tol)
127 std::cerr << std::scientific << std::setprecision(16)
128 <<
"mismatch in unit SI description, unity is not found" << std::endl
129 <<
"unit is " << test << std::endl;
133 if(abs((test.get_SI_factor()-unity)/unity) > tol)
135 std::cerr << std::scientific << std::setprecision(16)
136 <<
"mismatch in unit SI description, unity is not found" << std::endl
137 <<
"unit is " << test << std::endl;
142 if(abs((test.get_SI_factor()-milli)/milli) > tol)
144 std::cerr << std::scientific << std::setprecision(16)
145 <<
"mismatch in unit SI description, unity is not found" << std::endl
146 <<
"unit is " << test << std::endl;
156 std::vector<std::string> add;
157 for(
int i = 0; i < nAddition; i++)
164 for(
int i = 0; i < nAddition; i++)
167 if(ndot > 0)indice = rand() % ndot;
169 for(
int j = 0; j < indice; j++)
171 where = uu.find(
".",where);
173 if(where == 0)where = uu.size();
174 std::string ad =
"." + add[i];
177 if(ndot > 0)indice = rand() % ndot;
179 for(
int j = 0; j < indice; j++)
181 where = uu.find(
".",where);
183 if(where == 0)where = uu.size();
190 if(abs((test.get_SI_factor()-unity)/unity) > tol)
192 std::cerr << std::scientific << std::setprecision(16)
193 <<
"mismatch in unit combination, unity is not found" << std::endl
194 <<
"unit is " << test << std::endl;
198 std::cout <<
"Combination done at ";
199 (nAddition < 100)?std::cout <<
"low":std::cout <<
"high";
200 std::cout <<
" level" << std::endl;
205 test.set_unit(
"J/mol/K");
207 T Rcalc = RJ * test.factor_to_some_unit(
"cal/mol/K");
208 if(abs((Rcalc - Rcal)/Rcal) > tol && abs((Rcalc - Rcal)/Rcal) > abs(Runc/Rcal))
210 std::cerr << std::scientific << std::setprecision(16)
211 <<
"mismatch in R calculation" << std::endl
212 <<
"Rtheo = " << Rcal <<
" cal/mol/K" << std::endl
213 <<
"Rcal = " << Rcalc <<
" cal/mol/K" << std::endl
214 <<
"relative error = " << abs((Rcalc - Rcal)/Rcal) << std::endl
215 <<
"uncertainty in calorie = " << Runc << std::endl
216 <<
"tol = " << tol << std::endl;
226 std::cerr <<
"E = m * c *c failed, output unit is " << E.
get_symbol() << std::endl;
const std::string get_symbol() const
String symbol getter.
const UnitBaseConstant::UnitBaseStore< long double > known_units()
bool is_homogeneous(const Units< T > &rhs) const
Homogenity testing with another Units.