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

18
LINES

< > BotCompany Repo | #1010188 // doubleAverage

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

Libraryless. Click here for Pure Java version (2550L/16K).

static double doubleAverage(int... a) {
  double sum = 0;
  for i over a:
    sum += a[i];
  ret doubleRatio(sum, l(a));
}

static double doubleAverage(double... l) {
  ret doubleRatio(doubleSum(l), l(l));
}

static double doubleAverage(Iterable<Double> l) {
  double sum = 0;
  long n = 0;
  fOr (Double i : l)
    if (i != null) { sum += i; ++n; }
  ret doubleRatio(sum, n);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1010188
Snippet name: doubleAverage
Eternal ID of this version: #1010188/6
Text MD5: 92f756dac2e5574364b49a8568a0dc5c
Transpilation MD5: 51cdc266bfbeef87cf2dd8bbb994eb81
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-03 13:09:33
Source code size: 395 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 393 / 493
Version history: 5 change(s)
Referenced in: [show references]