Java Double Number Clamp clampMin(double input, double min)

Here you can find the source of clampMin(double input, double min)

Description

Ensures that a number is bigger than a given value.

License

Open Source License

Parameter

Parameter Description
input The number to clamp.
min The minimum value input is allowed to have.

Return

input , if it is bigger than min . Otherwise min is returned.

Declaration

public static double clampMin(double input, double min) 

Method Source Code

//package com.java2s;
/*/*from  www  . j a v  a2  s. c om*/
 * Copyright (c) 2014 mgamelabs
 * To see our full license terms, please visit https://github.com/mgamelabs/mengine/blob/master/LICENSE.md
 * All rights reserved.
 */

public class Main {
    /**
     * Ensures that a number is bigger than a given value.
     *
     * @param input The number to clamp.
     * @param min   The minimum value {@code input} is allowed to have.
     * @return {@code input}, if it is bigger than {@code min}. Otherwise  {@code min} is returned.
     */
    public static double clampMin(double input, double min) {
        if (input < min)
            return min;
        else
            return input;
    }
}

Related

  1. clampAngle(double angle)
  2. clampedLerp(double lowerBnd, double upperBnd, double slide)
  3. clampFloat(double in)
  4. clampMax(double val, double max)
  5. clampMax(final double MAX, final double VALUE)
  6. clampRoundShort(double in)
  7. clampToPercentageOrNAN(double input)
  8. clampVector(double d)