<commit_before>#ifndef DOUBLE_HPP
#define DOUBLE_HPP

#include <cmath>

static const double EPS = 1.0e-9;


template<int PRECISION>
static inline bool
eq(double a, double b)
{
  return std::abs(a - b) < std::pow(10.0, -PRECISION);
}

static inline bool
eq(double a, double b)
{
  return std::abs(a - b) < EPS;
}


template<int PRECISION>
static inline bool
neq(double a, double b)
{
  return std::abs(a - b) >= std::pow(10.0, -PRECISION);
}

static inline bool
neq(double a, double b)
{
  return std::abs(a - b) >= EPS;
}


template<int PRECISION>
static inline bool
lt(double a, double b)
{
  return a < b - std::pow(10.0, -PRECISION);
}

static inline bool
lt(double a, double b)
{
  return a < b - EPS;
}


template<int PRECISION>
static inline bool
leq(double a, double b)
{
  return a < b + std::pow(10.0, -PRECISION);
}

static inline bool
leq(double a, double b)
{
  return a < b + EPS;
}


template<int PRECISION>
static inline bool
gt(double a, double b)
{
  return a > b - std::pow(10.0, -PRECISION);
}

static inline bool
gt(double a, double b)
{
  return a > b - EPS;
}


template<int PRECISION>
static inline bool
geq(double a, double b)
{
  return a > b + std::pow(10.0, -PRECISION);
}

static inline bool
geq(double a, double b)
{
  return a > b + EPS;
}


template<int PRECISION>
static inline bool
isin(double x, double a, double b)
{
  return a - std::pow(10.0, -PRECISION) <= x && x <= b + std::pow(10.0, -PRECISION);
}

static inline bool
isin(double x, double a, double b)
{
  return a - EPS <= x && x <= b + EPS;
}


#endif  // DOUBLE_HPP
<commit_msg>Use template<commit_after>#ifndef DOUBLE_HPP
#define DOUBLE_HPP

#include <cmath>
#include <type_traits>


template<typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline constexpr double
geteps(int prec=9)
{
  return std::pow(static_cast<FType>(1.0), -prec - 1);
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
eq(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return std::abs(a - b) < eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
neq(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return std::abs(a - b) >= eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
lt(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return a < b - eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
leq(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return a < b + eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
gt(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return a > b - eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
geq(FType a, FType b)
{
  constexpr FType eps = geteps<FType>(PRECISION);
  return a > b + eps;
}


template<int PRECISION=9, typename FType=double, typename std::enable_if<std::is_floating_point<FType>::value, std::nullptr_t>::type = nullptr>
static inline bool
isin(FType x, FType a, FType b)
{
  return geq(x, a) && leq(x, b);
}



#endif  // DOUBLE_HPP

{'fraction_non_alphanumeric': 0.14399363564041368, 'fraction_numerical': 0.01007690267833466, 'mean_word_length': 4.912225705329154, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3340773', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1429, 'n_words': 386}