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

13
LINES

< > BotCompany Repo | #1036177 // combinePercentChanges

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

Libraryless. Click here for Pure Java version (9232L/51K).

1  
static double combinePercentChanges(Iterable<Double> l) {
2  
  double product = 1;
3  
  for (i : unnull(l))
4  
    if (i != null) product *= (i+100)/100;
5  
  ret product*100-100;
6  
}
7  
8  
static double combinePercentChanges(double... l) {
9  
  double product = 1;
10  
  for (i : unnull(l))
11  
    product *= (i+100)/100;
12  
  ret product*100-100;
13  
}

Author comment

Began life as a copy of #1019131

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036177
Snippet name: combinePercentChanges
Eternal ID of this version: #1036177/5
Text MD5: d085d5d412b4511637cb3cc3d43e5250
Transpilation MD5: 0b11ddd586c899037748aa5fc334f1ee
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-04 23:01:26
Source code size: 330 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 128 / 186
Version history: 4 change(s)
Referenced in: [show references]