Java Abs absCap(double value, double bounds)

Here you can find the source of absCap(double value, double bounds)

Description

Caps a value between -bounds to +bounds

License

Open Source License

Return

A value capped between two bounds.

Declaration

public static double absCap(double value, double bounds) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//w  w  w.j a  va2  s .co m
     * Caps a value between -bounds to +bounds
     *
     * @return A value capped between two bounds.
     */
    public static double absCap(double value, double bounds) {
        return Math.min(Math.max(value, -bounds), bounds);
    }

    public static float absCap(float value, float bounds) {
        return Math.min(Math.max(value, -bounds), bounds);
    }
}

Related

  1. abs2(float[] f)
  2. abs_fractional(double number)
  3. abs_min(double a, double b)
  4. absAngleDifference(double angle1Radians, double angle2Radians)
  5. absApproximation(double x, double M)
  6. absClamp(double value, double bounds)
  7. absDegrees(double degrees)
  8. absDelta(double a, double b)
  9. absDelta(float f1, float f2)