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

13
LINES

< > BotCompany Repo | #1029191 - Average

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

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

sclass Average {
  double sum;
  long n;
  
  void add(double d) {
    ++n;
    sum += d;
  }
  
  double get() {
    ret doubleRatio(sum, n);
  }
}

Author comment

Began life as a copy of #1019129

download  show line numbers  debug dex   

Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029191
Snippet name: Average
Eternal ID of this version: #1029191/1
Text MD5: 20245217453e66c5684e03d85dda7298
Transpilation MD5: 2486382a30b08ab383d892ac659f0595
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-24 17:34:10
Source code size: 160 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 17 / 66
Referenced in: [show references]

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