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: | 714 / 889 |
| Version history: | 5 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1024748 - floatAverage #1026899 - intAverage (as double) #1036051 - longAverage #1036438 - smoothedMovingAverage |