Java Double Number Clamp clamp(double val, double min, double max)

Here you can find the source of clamp(double val, double min, double max)

Description

clamp

License

LGPL

Declaration

public static double clamp(double val, double min, double max) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static double clamp(double val, double min, double max) {
        return Math.max(min, Math.min(max, val));
    }//from  www .  j  a  v  a  2 s .  c o  m

    public static float clamp(float val, float min, float max) {
        return Math.max(min, Math.min(max, val));
    }

    public static int clamp(int val, int min, int max) {
        return Math.max(min, Math.min(max, val));
    }
}

Related

  1. clamp(double v, double l, double h)
  2. clamp(double v, double lower, double upper)
  3. clamp(double v, double lower, double upper)
  4. clamp(double val)
  5. clamp(double val)
  6. clamp(double val, double min, double max)
  7. clamp(double value)
  8. clamp(double value)
  9. clamp(double value, double low, double high)