16 inline bool is_equal(
double a,
double b,
double error_factor = 1.0)
19 std::abs(a - b) < std::abs(std::fmin(a, b)) * std::numeric_limits<double>::epsilon() * error_factor;
22 inline void asci_to_protobuf(std::string a, std::string & p)
24 std::stringstream sstream(a);
26 while (sstream.good()) {
29 char c = char(bits.to_ulong());
34 inline void protobuf_to_asci(std::string p, std::string & a)
36 for (std::size_t i = 0; i < p.size(); ++i) {
37 std::bitset<8> xx = std::bitset<8>(p[i]);
41 inline int mkpath(
const char * dir, mode_t mode)
48 if (!stat(dir, &st))
return 0;
49 mkpath(dirname(strdupa(dir)), mode);
50 return mkdir(dir, mode);