<commit_before>#ifndef JEBMATH_UTILTIES_HPP
#define JEBMATH_UTILTIES_HPP

#include <cmath>
#include "Constants.hpp"

namespace JEBMath {

template <typename T>
T getSign(T value)
{
    if (value > 0)
        return T(1);
    else if (value < 0)
        return T(-1);
    else
        return T(0);
}

constexpr double toRadians(double degrees)
{
    return degrees * Pi / 180;
}
<commit_msg>Added double-compare.<commit_after>#ifndef JEBMATH_UTILTIES_HPP
#define JEBMATH_UTILTIES_HPP

#include <cmath>
#include "Constants.hpp"

namespace JEBMath {

inline int compare(double a, double b, double tolerance)
{
  auto d = a - b;
  if (std::fabs(d) < tolerance)
    return 0;
  return d < 0 ? -1 : 1;
}

template <typename T>
T getSign(T value)
{
    if (value > 0)
        return T(1);
    else if (value < 0)
        return T(-1);
    else
        return T(0);
}

constexpr double toRadians(double degrees)
{
    return degrees * Pi / 180;
}

{'fraction_non_alphanumeric': 0.11501597444089456, 'fraction_numerical': 0.021299254526091587, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '5088635', 'n_tokens_mistral': 364, 'n_tokens_neox': 346, 'n_words': 99}