bschiffthaler / seidr

Toolkit to create crowd networks
GNU General Public License v3.0
2 stars 1 forks source link

tomsimilarity default sft-cutoff value incorrect #33

Closed loalon closed 3 years ago

loalon commented 3 years ago

tomsimilarity help screen prints a sft-cutoff default value of TOM_DEF_FIT, where it should be 0.8.

This bug seems to only affect the help screen, the issue is probably in tomsimilarity.cpp, line 87

bschiffthaler commented 3 years ago

This is probably true for many (if not most help screens). Looks like this macro works if TOM_DEF_FIT is also a macro, but to make typing more consistent, these were all changed recently be constexpr:

Works

#define TOM_DEF_FIT 0.8
default_value(TOM_DEF_FIT, _XSTR(TOM_DEF_FIT))

Doesn't

constexpr double TOM_DEF_FIT = 0.8;
default_value(TOM_DEF_FIT, _XSTR(TOM_DEF_FIT))

We can do something like this to print a nice looking string repr:

template<typename T>
std::string to_rounded_str(T s, uint64_t digits = 2) {
  std::stringstream ss;
  ss << std::setprecision(digits);
  ss << s;
  return ss.str();
}