<commit_before>#ifndef MATH_HPP
#define MATH_HPP

#include <algorithm>
#include <cmath>
#include <math.h>

#define PI 3.14159265358979323846f
#define TAU 6.28318530717958647692f
#define KAPPA90 0.5522847493f

// KAPPA90 = (4/3 * (sqrt(2) - 1))
// https://de.wikipedia.org/wiki/Datei:Circle-cbezier-method2.svg

#define OE_FLOAT_INFINITY std::numeric_limits<float>::infinity()

#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(0[arr]))

namespace OrbitEngine { namespace Math {

	inline double deg2rad(double deg)
	{
		return deg * PI / 180.f;
	}

	inline double rad2deg(double rad)
	{
		return rad * 180.f / PI;
	}
	
	inline unsigned int nextPowerOfTwo(unsigned int x)
	{
		x--;
		x |= x >> 1;
		x |= x >> 2;
		x |= x >> 4;
		x |= x >> 8;
		x |= x >> 16;
		x++;
		return x;
	}

	inline bool isPowerOfTwo(unsigned int x) {
		return x == 0 || (x & (x - 1)) == 0;
	}

	template<typename T>
	inline T approximatelyEqual(T a, T b, T epsilon)
	{
		return std::abs(a - b) <= ((std::abs(a) < std::abs(b) ? std::abs(b) : std::abs(a)) * epsilon);
	}

	template<typename T>
	inline T lerp(T v0, T v1, float t) {
		return (1.f - t) * v0 + t * v1;
	}

	template<typename T>
	inline T clamp(T input, T min_, T max_) {
		return (std::max)(min_, (std::min)(input, max_));
	}

	template<typename T>
	inline T sign(T input)
	{
		return input >= (T)0 ? (T)1 : (T)-1;
	};

	template<typename A, typename B>
	A castMinMax(B in)
	{
		// only integer types

		A retVal = 0;

		if (in > 0)
			retVal = static_cast<A>(in & std::numeric_limits<A>::max());
		else if (in < 0)
			retVal = static_cast<A>(in | std::numeric_limits<A>::min());

		return retVal;
	}
} }

#endif<commit_msg>fix lerp, was inverted<commit_after>#ifndef MATH_HPP
#define MATH_HPP

#include <algorithm>
#include <cmath>
#include <math.h>

#define PI 3.14159265358979323846f
#define TAU 6.28318530717958647692f
#define KAPPA90 0.5522847493f

// KAPPA90 = (4/3 * (sqrt(2) - 1))
// https://de.wikipedia.org/wiki/Datei:Circle-cbezier-method2.svg

#define OE_FLOAT_INFINITY std::numeric_limits<float>::infinity()

#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(0[arr]))

namespace OrbitEngine { namespace Math {

	inline double deg2rad(double deg)
	{
		return deg * PI / 180.f;
	}

	inline double rad2deg(double rad)
	{
		return rad * 180.f / PI;
	}
	
	inline unsigned int nextPowerOfTwo(unsigned int x)
	{
		x--;
		x |= x >> 1;
		x |= x >> 2;
		x |= x >> 4;
		x |= x >> 8;
		x |= x >> 16;
		x++;
		return x;
	}

	inline bool isPowerOfTwo(unsigned int x) {
		return x == 0 || (x & (x - 1)) == 0;
	}

	template<typename T>
	inline T approximatelyEqual(T a, T b, T epsilon)
	{
		return std::abs(a - b) <= ((std::abs(a) < std::abs(b) ? std::abs(b) : std::abs(a)) * epsilon);
	}

	template<typename T>
	inline T lerp(T v0, T v1, float t) {
		return v0 + (v1 - v0) * t;
	}

	template<typename T>
	inline T clamp(T input, T min_, T max_) {
		return (std::max)(min_, (std::min)(input, max_));
	}

	template<typename T>
	inline T sign(T input)
	{
		return input >= (T)0 ? (T)1 : (T)-1;
	};

	template<typename A, typename B>
	A castMinMax(B in)
	{
		// only integer types

		A retVal = 0;

		if (in > 0)
			retVal = static_cast<A>(in & std::numeric_limits<A>::max());
		else if (in < 0)
			retVal = static_cast<A>(in | std::numeric_limits<A>::min());

		return retVal;
	}
} }

#endif
{'fraction_non_alphanumeric': 0.1729028364514182, 'fraction_numerical': 0.05491852745926373, 'mean_word_length': 3.4616419919246297, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 53, 'https://': 2, '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': '1050603', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1364, 'n_words': 353}