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

15
LINES

< > BotCompany Repo | #1018737 // clamp

JavaX fragment (include)

1  
static float clamp(float x, float a, float b) {
2  
  ret x < a ? a : x > b ? b : x;
3  
}
4  
5  
static double clamp(double x, double a, double b) {
6  
  ret x < a ? a : x > b ? b : x;
7  
}
8  
9  
static int clamp(int x, int a, int b) {
10  
  ret x < a ? a : x > b ? b : x;
11  
}
12  
13  
static long clamp(long x, long a, long b) {
14  
  ret x < a ? a : x > b ? b : x;
15  
}

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: 477 / 547
Version history: 3 change(s)
Referenced in: [show references]