Libraryless. Click here for Pure Java version (40L/1K).
1 | static float rclamp(float a, float b, float x) { |
2 | ret x < a ? a : x > b ? b : x; |
3 | } |
4 | |
5 | static double rclamp(double a, double b, double x) { |
6 | ret x < a ? a : x > b ? b : x; |
7 | } |
8 | |
9 | static int rclamp(int a, int b, int x) { |
10 | ret x < a ? a : x > b ? b : x; |
11 | } |
12 | |
13 | static long rclamp(long a, long b, long x) { |
14 | ret x < a ? a : x > b ? b : x; |
15 | } |
Began life as a copy of #1018737
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032595 |
Snippet name: | rclamp |
Eternal ID of this version: | #1032595/1 |
Text MD5: | 214619ec659ec7390cc09692cef2fa41 |
Transpilation MD5: | 10a7d7fe1f18149bf9a63e068da97c85 |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-23 09:24:07 |
Source code size: | 344 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 170 / 248 |
Referenced in: | [show references] |