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

44
LINES

< > BotCompany Repo | #1001796 - min function

JavaX fragment (include)

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

Author comment

Began life as a copy of #1001664

download  show line numbers  debug dex   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001796
Snippet name: min function
Eternal ID of this version: #1001796/3
Text MD5: b3e9a9e68362cd1207d46e1e600ebde3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-11 13:43:15
Source code size: 871 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 552 / 4308
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1001796 & http://1001796.tinybrain.de