<commit_before>#include <3DGeo/angle.hh>

Angle::Angle()
{
    _val = 0;
}

Angle::Angle(double rad)
{
    _val = convert(rad);
    simplify();
}

double Angle::GetRad() const
{
    return (unConvert(_val));
}

double Angle::GetDeg() const
{
    return (RadToDeg(GetRad()));
}

double Angle::Cos() const
{
    return (cos(unConvert(_val)));
}

double Angle::Sin() const
{
    return (sin(unConvert(_val)));
}

double Angle::Tan() const
{
    return (tan(unConvert(_val)));
}

Angle &Angle::operator=(const Angle &b)
{
    _val = b._val;
    simplify();
    return (*this);
}

Angle &Angle::operator=(const double &b)
{
    _val = convert(b);
    simplify();
    return (*this);
}

Angle Angle::operator+(const Angle &b) const
{
    Angle ret(unConvert(_val + b._val));

    return (ret);
}

Angle Angle::operator-(const Angle &b) const
{
    Angle ret(unConvert(_val - b._val));

    return (ret);
}

Angle Angle::operator-() const
{
    Angle ret(-unConvert(_val));

    return (ret);
}

Angle Angle::operator*(const int &b) const
{
    Angle ret(unConvert(_val) * (double)b);

    return (ret);
}

Angle Angle::operator/(const int &b) const
{
    Angle ret(unConvert(_val) / (double)b);

    return (ret);
}

double Angle::DegToRad(double deg)
{
    return (M_PI * deg / (double)180);
}

double Angle::RadToDeg(double rad)
{
    return ((double)180 * rad / M_PI);
}

void Angle::simplify()
{
    while (_val > ANGLE_MAX_VALUE)
        _val -= ANGLE_MAX_VALUE;
    while (_val < -ANGLE_MAX_VALUE)
        _val += ANGLE_MAX_VALUE;
}

int Angle::convert(double rad) const
{
    return ((int)(rad * ANGLE_CONVERSION));
}

double Angle::unConvert(int val) const
{
    return ((double)val / (double)ANGLE_CONVERSION);
}

ostream &operator<<(ostream& os, const Angle& x)
{
    os << x.GetDeg();
    return (os);
}<commit_msg>bugfix for angle simplicfication<commit_after>#include <3DGeo/angle.hh>

Angle::Angle()
{
    _val = 0;
}

Angle::Angle(double rad)
{
    _val = convert(rad);
    simplify();
}

double Angle::GetRad() const
{
    return (unConvert(_val));
}

double Angle::GetDeg() const
{
    return (RadToDeg(GetRad()));
}

double Angle::Cos() const
{
    return (cos(unConvert(_val)));
}

double Angle::Sin() const
{
    return (sin(unConvert(_val)));
}

double Angle::Tan() const
{
    return (tan(unConvert(_val)));
}

Angle &Angle::operator=(const Angle &b)
{
    _val = b._val;
    simplify();
    return (*this);
}

Angle &Angle::operator=(const double &b)
{
    _val = convert(b);
    simplify();
    return (*this);
}

Angle Angle::operator+(const Angle &b) const
{
    Angle ret(unConvert(_val + b._val));

    return (ret);
}

Angle Angle::operator-(const Angle &b) const
{
    Angle ret(unConvert(_val - b._val));

    return (ret);
}

Angle Angle::operator-() const
{
    Angle ret(-unConvert(_val));

    return (ret);
}

Angle Angle::operator*(const int &b) const
{
    Angle ret(unConvert(_val) * (double)b);

    return (ret);
}

Angle Angle::operator/(const int &b) const
{
    Angle ret(unConvert(_val) / (double)b);

    return (ret);
}

double Angle::DegToRad(double deg)
{
    return (M_PI * deg / (double)180);
}

double Angle::RadToDeg(double rad)
{
    return ((double)180 * rad / M_PI);
}

void Angle::simplify()
{
    while (_val > 2 * ANGLE_MAX_VALUE)
        _val -= (2 * ANGLE_MAX_VALUE);
    while (_val < 2 * (-ANGLE_MAX_VALUE))
        _val += (2 * ANGLE_MAX_VALUE);
    if (_val > ANGLE_MAX_VALUE)
        _val -= 2 * ANGLE_MAX_VALUE;
    else if (_val < -ANGLE_MAX_VALUE)
        _val += 2 * ANGLE_MAX_VALUE;
}

int Angle::convert(double rad) const
{
    return ((int)(rad * ANGLE_CONVERSION));
}

double Angle::unConvert(int val) const
{
    return ((double)val / (double)ANGLE_CONVERSION);
}

ostream &operator<<(ostream& os, const Angle& x)
{
    os << x.GetDeg();
    return (os);
}
{'fraction_non_alphanumeric': 0.17019607843137255, 'fraction_numerical': 0.005751633986928104, 'mean_word_length': 3.527810650887574, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 8, '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': '5487593', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1420, 'n_words': 320}