using System;

namespace MultiWheelC.TrajectoryPlanning.Utils;

public static class NumericGuard
{
    public static bool IsFinite(double value) { return !double.IsNaN(value) && !double.IsInfinity(value); }
    public static bool IsFinite(float value) { return !float.IsNaN(value) && !float.IsInfinity(value); }
    public static bool IsPositiveFinite(double value) { return IsFinite(value) && value > 0d; }
    public static bool IsInRange(float value, float minimum, float maximum)
    {
        return IsFinite(value) && value >= minimum && value <= maximum;
    }
}
