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

17
LINES

< > BotCompany Repo | #1032656 // doubleMultiMinus

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3804L/22K).

static double doubleMultiMinus(Iterable<Double> l) {
  var it = iterator(l);
  if (!it.hasNext()) ret 0;
  double x = it.next();
  while (it.hasNext())
    x -= it.next();
  ret x;
}

static double doubleMultiMinus(double... l) {
  int n = l(l);
  if (n == 0) ret 0;
  double x = l[0];
  for (int i = 1; i < n; i++)
    x -= l[i];
  ret x;
}

Author comment

Began life as a copy of #1019131

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032656
Snippet name: doubleMultiMinus
Eternal ID of this version: #1032656/3
Text MD5: 29974687d2643023cefe4d6ccaf289a8
Transpilation MD5: b3619408b644b5cd8dc0cceebecc769d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-30 05:16:36
Source code size: 357 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 138 / 190
Version history: 2 change(s)
Referenced in: [show references]