Class MathUtils

java.lang.Object
com.arbergashi.charts.util.MathUtils

public final class MathUtils extends Object
Math utilities.
Since:
2025-06-01
Version:
1.0.0
Author:
Arber Gashi
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    clamp(double val, double min, double max)
    Constraints a value to the interval [min, max].
    static double
    clamp01(double v)
    Clamps value into [0,1] range (double version).
    static float
    clamp01(float v)
    Clamps value into [0,1] range (float version).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • clamp

      public static double clamp(double val, double min, double max)
      Constraints a value to the interval [min, max]. (Wrapper for Math.clamp starting from JDK 21, here as fallback/alias).
    • clamp01

      public static double clamp01(double v)
      Clamps value into [0,1] range (double version).
    • clamp01

      public static float clamp01(float v)
      Clamps value into [0,1] range (float version).