Libraryless. Click here for Pure Java version (103L/1K).
static int min(int a, int b) { ret Math.min(a, b); } static long min(long a, long b) { ret Math.min(a, b); } static float min(float a, float b) { ret Math.min(a, b); } static float min(float a, float b, float c) { ret min(min(a, b), c); } static double min(double a, double b) { ret Math.min(a, b); } static double min(double[] c) { double x = Double.MAX_VALUE; for (double d : c) x = Math.min(x, d); ret x; } static float min(float[] c) { float x = Float.MAX_VALUE; for (float d : c) x = Math.min(x, d); ret x; } static byte min(byte[] c) { byte x = 127; for (byte d : c) if (d < x) x = d; ret x; } static short min(short[] c) { short x = 0x7FFF; for (short d : c) if (d < x) x = d; ret x; } static int min(int[] c) { int x = Int.MAX_VALUE; for (int d : c) if (d < x) x = d; ret x; } static <A extends Comparable<A>> A min(A a, A b) { ret cmp(a, b) <= 0 ? a : b; }
Began life as a copy of #1001664
download show line numbers debug dex old transpilations
Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, uelavcdoioby, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001796 |
Snippet name: | min function |
Eternal ID of this version: | #1001796/4 |
Text MD5: | cad25230c3ef70b711f299e975dfcdf4 |
Transpilation MD5: | b2f25d1d707d5c517303ec815bfbff73 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-20 22:18:12 |
Source code size: | 959 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 989 / 5337 |
Version history: | 3 change(s) |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |