<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SamSeifert.Utilities
{
    public class MathUtil
    {
        public static int ModGuaranteePositive(int x, int mod)
        {
            return (x % mod + mod) % mod;
        }

        public static float ModGuaranteePositive(float x, float mod)
        {
            return (x % mod + mod) % mod;
        }

        public static double ModGuaranteePositive(double x, double mod)
        {
            return (x % mod + mod) % mod;
        }

        public static int Clamp(int min, int max, int val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static float Clamp(float min, float max, float val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static Decimal Clamp(Decimal min, Decimal max, Decimal val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static void Clamp(float min, float max, float[] val)
        {
            for (int i = 0; i < val.Length; i++)
                val[i] = Clamp(min, max, val[i]);
        }

        public class Continuous360_Radians
        {
            protected readonly float _Increment;

            private bool _First = true;
            private float _Angle = 0;
            private int _TurnCount = 0;

            protected Continuous360_Radians(float inc)
            {
                this._Increment = inc;
            }

            public Continuous360_Radians() : this(UnitConverter.PIF * 2)
            {<commit_msg>DOuble CLamp<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SamSeifert.Utilities
{
    public class MathUtil
    {
        public static int ModGuaranteePositive(int x, int mod)
        {
            return (x % mod + mod) % mod;
        }

        public static float ModGuaranteePositive(float x, float mod)
        {
            return (x % mod + mod) % mod;
        }

        public static double ModGuaranteePositive(double x, double mod)
        {
            return (x % mod + mod) % mod;
        }



        public static int Clamp(int min, int max, int val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static float Clamp(float min, float max, float val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static double Clamp(double min, double max, double val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static Decimal Clamp(Decimal min, Decimal max, Decimal val)
        {
            return Math.Min(max, Math.Max(min, val));
        }

        public static void Clamp(float min, float max, float[] val)
        {
            for (int i = 0; i < val.Length; i++)
                val[i] = Clamp(min, max, val[i]);
        }






        public class Continuous360_Radians
        {
            protected readonly float _Increment;

            private bool _First = true;
            private float _Angle = 0;
            private int _TurnCount = 0;

            protected Continuous360_Radians(float inc)
            {
                this._Increment = inc;
            }

            public Continuous360_Radians() : this(UnitConverter.PIF * 2)
            {
{'fraction_non_alphanumeric': 0.08903712296983758, 'fraction_numerical': 0.0075406032482598605, 'mean_word_length': 1.655119322555812, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3889844', 'n_tokens_mistral': 1007, 'n_tokens_neox': 947, 'n_words': 290}