Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1018737 // clamp

JavaX fragment (include)

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;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018737
Snippet name: clamp
Eternal ID of this version: #1018737/4
Text MD5: 68e24029359e84a57f7040ea0ce6fdcd
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 06:44:31
Source code size: 340 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 475 / 544
Version history: 3 change(s)
Referenced in: [show references]