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

14
LINES

< > BotCompany Repo | #1024748 // floatAverage

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

Libraryless. Click here for Pure Java version (1780L/12K).

static float floatAverage(int... a) {
  float sum = 0;
  for i over a:
    sum += a[i];
  ret floatRatio(sum, l(a));
}

static float floatAverage(float... l) {
  ret floatRatio(floatSum(l), l(l));
}

static float floatAverage(Collection<Float> l) {
  ret floatRatio(floatSum(l), l(l));
}

Author comment

Began life as a copy of #1010188

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024748
Snippet name: floatAverage
Eternal ID of this version: #1024748/1
Text MD5: 10530d5f9e7c8e1b7f5d1bf078397b84
Transpilation MD5: b0efcd31cb61535a51f87e2d0136fd72
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 16:10:41
Source code size: 300 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 287
Referenced in: [show references]