static float clamp(float x, float a, float b) { ret x < a ? a : x > b ? b : x; } static double clamp(double x, double a, double b) { ret x < a ? a : x > b ? b : x; } static int clamp(int x, int a, int b) { ret x < a ? a : x > b ? b : x; } static long clamp(long x, long a, long b) { ret x < a ? a : x > b ? b : x; }